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 

太不可思议了。 
posted @ 2011-11-01 16:38  把爱延续  阅读(8803)  评论(0编辑  收藏  举报