span 标记的可编辑与不可编辑

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
  
 <HTML> 
 <HEAD> 
 <TITLE>Untitled</TITLE> 
 <LINK REL="stylesheet" HREF="samplesSDKIE4.css" TYPE="text/css"> 
 <SCRIPT type="text/javascript"> 
 function chgSpan() {  
 currentState = oSpan.isContentEditable;  
 newState = !currentState;  
 oSpan.contentEditable = newState;  
 oCurrentValue.innerText = newState;  
 newState==false ? oBtn.innerText="Enable Editing" :  
 oBtn.innerText="Disable Editing"  
 }  
 </SCRIPT>  
 </HEAD> 
 <!--TOOLBAR_START--> 
 <!--TOOLBAR_EXEMPT--> 
 <!--TOOLBAR_END--> 
 <BODY onload="oCurrentValue.innerText = oSpan.isContentEditable;"> 
 <DIV class="body"> 
 <P>Click the button to enable or disable SPAN content editing.</P> 
 <P><BUTTON ID="oBtn" onclick="chgSpan()">Enable Editing</BUTTON></P> 
 <P><SPAN ID="oSpan">You can edit this text.</SPAN></P> 
 <P>SPAN can be edited: <SPAN ID="oCurrentValue"></SPAN></P> 
  
  
 <!-- START_PAGE_FOOTER --> 
 <BR><BR><BR> 
 <p class="viewsource">[Right-click and choose View Source from the shortcut menu.] </p> 
 <A class="copyright" HREF="http://www.microsoft.com/isapi/gomscom.asp?TARGET=/info/cpyright.htm">© 2007

Microsoft Corporation. All rights reserved. Terms of use.</A> 
 <!-- END_PAGE_FOOTER --> 
 </DIV> 
 </BODY> 
 </HTML>
http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/contentEditableEX2.htm  
金老师,我刚刚发现的一个demo:可以设置特定的html标记的可编辑性。

http://msdn.microsoft.com/en-gb/library/ms537837(VS.85).aspx 

太不可思议了。 


返回导读目录,阅读更多随笔



分割线,以下为博客签名:

软件臭虫情未了
  • 编码一分钟
  • 测试十年功


随笔如有错误或不恰当之处、为希望不误导他人,望大侠们给予批评指正。

原文地址:https://www.cnblogs.com/08shiyan/p/2231836.html