innerHTML 如何保留数值里面双引号如 size="20" 20
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.0Transitional//EN"><HTML><HEAD><TITLE>后台管理</TITL...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>后台管理</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content=Alan name=Author><LINK rev=MADE
href="mailto:haowubai@hotmail.com"><LINK href="images/private.css"
type=text/css rel=stylesheet>
<META content="MSHTML 6.00.6000.16890" name=GENERATOR></HEAD>
<html>
<head>
<title> 最简单的在线编辑器 </title>
<style>
body{font-size:12px;}
#edit,#view{border:1px solid red;width:100%;height:200px;overflow-y:auto;margin-bottom:10px;}
#view{border-color:#ddd;}
</style>
</head>
<body>
最简单的在线编辑器, only for ie
<div style="visibility: hidden" id="edit" contenteditable="true">
<font size= '/"20/"' ></font>
</div>
<div style="visibility: hidden" id="edit2" contenteditable="true">
<font size = "20">dfdsdfsdfsdfsdfsdf fdsdf</font>
</div>
<div style="visibility: hidden" id="edit3" contenteditable="true">
<font size = "20" >fffffffffffffffffffffew</font>
======</div>
<div id="edit4" contenteditable="true">
</div>
<input type="button" value="20号字" onclick="document.getElementById('view').value=document.getElementById('edit').innerHTML">
<input type="button" value="10号字" onclick="document.getElementById('view').value=document.getElementById('edit2').innerHTML">
<input type="button" value="5号字" onclick="document.getElementById('view').value=document.getElementById('edit3').innerHTML">
<input type="button" value="更新编辑区↑" onclick="document.getElementById('edit4').innerHTML=document.getElementById('view').value">
<textarea id="view">
代码区
</textarea>
</body>
</html>
============================
以上代码产生出来的
font size=20 能不能做到size="20" 保留引号。。。
能好久都不会。。谢谢各位! 展开
<HTML><HEAD><TITLE>后台管理</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content=Alan name=Author><LINK rev=MADE
href="mailto:haowubai@hotmail.com"><LINK href="images/private.css"
type=text/css rel=stylesheet>
<META content="MSHTML 6.00.6000.16890" name=GENERATOR></HEAD>
<html>
<head>
<title> 最简单的在线编辑器 </title>
<style>
body{font-size:12px;}
#edit,#view{border:1px solid red;width:100%;height:200px;overflow-y:auto;margin-bottom:10px;}
#view{border-color:#ddd;}
</style>
</head>
<body>
最简单的在线编辑器, only for ie
<div style="visibility: hidden" id="edit" contenteditable="true">
<font size= '/"20/"' ></font>
</div>
<div style="visibility: hidden" id="edit2" contenteditable="true">
<font size = "20">dfdsdfsdfsdfsdfsdf fdsdf</font>
</div>
<div style="visibility: hidden" id="edit3" contenteditable="true">
<font size = "20" >fffffffffffffffffffffew</font>
======</div>
<div id="edit4" contenteditable="true">
</div>
<input type="button" value="20号字" onclick="document.getElementById('view').value=document.getElementById('edit').innerHTML">
<input type="button" value="10号字" onclick="document.getElementById('view').value=document.getElementById('edit2').innerHTML">
<input type="button" value="5号字" onclick="document.getElementById('view').value=document.getElementById('edit3').innerHTML">
<input type="button" value="更新编辑区↑" onclick="document.getElementById('edit4').innerHTML=document.getElementById('view').value">
<textarea id="view">
代码区
</textarea>
</body>
</html>
============================
以上代码产生出来的
font size=20 能不能做到size="20" 保留引号。。。
能好久都不会。。谢谢各位! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询