getElementById的一点小问题 <Form Action="" Name="myform" Method="GET"> message: <br></Form>你把form去掉就可以了,可能是Form隔了一层 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>form</title><script type="text/javascript">function decodeMessage(){ //alert("oj"); document.getElementById("Content_div").innerHTML="HelloWorld";}</script></head><body><Form Action="" Name="myform" Method="GET"> message: <br><div id="Content_div"></div><Input Type="text" Name="inputbox" Value="" > <P><Input Type="button" Name="button" Value="Transform" onclick="decodeMessage()" ></Form></body></html> javascript 是大小写敏感的, document.getElementById("Content_div").innerHTML document.getElementById("Content_div").innerText 这两个你是要用哪个? 楼上的人都说了,的确是要写成innerHTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>form</title><script type="text/javascript">function decodeMessage(){ document.getElementById("Content_div").innerHTML="HelloWorld";}</script></head><body><Form Action="" Name="myform" Method="GET"> message: <br><Input Type="text" Name="inputbox" Value="" > <P><Input Type="button" Name="button" Value="Transform" onClick="decodeMessage()" ><div id="Content_div"></div></Form></body></html>运行结果:HelloWorld 如何能重新请求页面 WEB开发,js应用好重要哦,如何写好JS文件呢?? jquery如何读取XML的文本节点 风之石框架研究 之 用简洁的话谈谈下面的功能 请教如何在js将值传入DropDownList呢,急,谢谢! multiple formlist 搞不定了 能解决的 人 会出现么??? 50分,不够再加 用javascript怎样实现一个有“是”、“否”两个按钮的对话框。 如何得到页面中text的高度? 如何才能在SCRIPT中取到被选中的radio的值? 【初级问题】:如何在字符串插入字符? jquery.ui高手进..解决个小问题
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>form</title>
<script type="text/javascript">
function decodeMessage(){
//alert("oj");
document.getElementById("Content_div").innerHTML="HelloWorld";
}
</script>
</head><body>
<Form Action="" Name="myform" Method="GET"> message: <br>
<div id="Content_div"></div>
<Input Type="text" Name="inputbox" Value="" > <P>
<Input Type="button" Name="button" Value="Transform" onclick="decodeMessage()" >
</Form></body>
</html>
document.getElementById("Content_div").innerHTML
document.getElementById("Content_div").innerText 这两个你是要用哪个?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>form</title>
<script type="text/javascript">
function decodeMessage(){
document.getElementById("Content_div").innerHTML="HelloWorld";
}
</script>
</head><body>
<Form Action="" Name="myform" Method="GET"> message: <br>
<Input Type="text" Name="inputbox" Value="" > <P>
<Input Type="button" Name="button" Value="Transform" onClick="decodeMessage()" >
<div id="Content_div"></div>
</Form></body>
</html>运行结果:
HelloWorld