==>关于转义字符的问题,谢谢先^_^
为什么把document.form.input.value赋给变量的时候,会自动把“<“转换成“<”、">"转换成">"呢?如何能禁止这样呢?
情况是这样的:
我用下面这个代码是页面显示内容是:<aadada>asda
<script>
function mr()
{
var cjh = "<aadada>asda";
Editor.document.body.innerHTML = cjh ;
}
function initEditor()
{
Editor.document.designMode="on";
Editor.document.open();
initHTML = "";
Editor.document.write(initHTML);
Editor.document.close();
mr();
Editor.document.body.style.fontFamily = "Courier New","宋体";
Editor.document.body.style.fontSize ="12px";
}
</script>
<body onload="initEditor()">
<iframe id="Editor" Name="Editor" width=99% height=400 marginwidth="0" marginheight="0"></iframe>
</body>
而用下面这个代码是页面显示内容是:asda
<script>
function mr()
{
var cjh = document.form1.content.value ;
Editor.document.body.innerHTML = cjh ;
}
//初始化编辑器
function initEditor()
{
Editor.document.designMode="on";
Editor.document.open();
initHTML = "";
Editor.document.write(initHTML);
Editor.document.close();
mr();
Editor.document.body.style.fontFamily = "Courier New","宋体";
Editor.document.body.style.fontSize ="12px";
}
</script>
<body onload="initEditor()">
<iframe id="Editor" Name="Editor" width=99% height=400 marginwidth="0" marginheight="0"></iframe>
<form name="form1"><input name="content" type="hidden" id="content" value="<aadada>asda"></form>
</body>
一个是直接赋值,一个是通过隐藏的输入框赋值,结果却差别这么大?
大家救命啊
[此贴子已经被作者于2005-4-27 16:55:38编辑过]