好奇怪的HTML问题,关于textarea的
我页面上有一个
<textarea name= "apply " cols= "80 " rows= "10 "> </textarea>
然后我在后面有段javascript:
document.writing.apply.innerHTML= "sadfsdf <br> ";
然后就出错了:
未知的运行时错误
是我的方法不正确吗?请问怎么用javascript写textarea的HTML内容?
------解决方案-------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
</HEAD>
<BODY>
<textarea name= "apply " cols= "80 " rows= "10 "> </textarea>
</BODY>
<SCRIPT LANGUAGE= "JavaScript ">
<!--
document.getElementById( "apply ").value= "sadfsdf\nxxx ";
//-->
</SCRIPT> </HTML>
------解决方案--------------------好象直接赋值就可以哎
------解决方案--------------------sorry,没有测试FF.看来要装个FF:)
------解决方案--------------------...只是单纯的要换行的话可以写入 "\r "
文本节点就是显示 " <br /> "而不是显示换行...
忽忽..我也是为了测试才装的FF....
感觉上cmsoft的挺简单的....就用那个好啦....回家啦.北..
------解决方案-------------------- <textarea name= "apply " cols= "80 " rows= "10 "> </textarea>
友情提示,这个textarea 没有指定ID 应该用
document.getElementByName( "apply ").innerHTML
------解决方案--------------------document.writing.apply.value= "sadfsdf <br> ";