解决方案 »
- 怎么输入才正确,请指点!
- js困惑求助
- java script 页面随机刷新
- 如何将一个集合数组内的元素动态填入固定行列的Table单元格中
- 如何把从数据库中读取的内容作成.js文件?急用,谢谢了
- jquery插件中,json返回的data如何被一个click事件的处理函数调用
- 我使用了别人的一个控件,在当前页面会弹出一个窗口.但这个窗口是没有名字的..我如何可以用脚本获得本页弹出的所有窗口啊?
- document.all方法应用
- 求关于javascript访问XML方面的帮助文件(手册),越详细越好(急!送高分!)
- 如何计算某年某月的天数和每天对应的星期
- js问题,麻烦大家帮我回答下,谢谢~!
- javascript搜索框
<html>
<head>
<script type="text/javascript" >
function changeName()
{
//alert("run here")
var p1=document.getElementById('p1')
p1.setAttribute('name',"p2")
document.getElementsByName("p2")[0].innerHTML="hello,world!"
//alert('here')
}
</script>
</head>
<body>
<p id="p1" name="p1">Hello</p>
<button onclick="changeName()">改变名字并输出</button></body>
</html>
<head>
<script type="text/javascript" />
function changeName()
{
alert("run here")
var p1=document.getElementById('p1')
p1.setAttribute('name',"p2")
document.getElementsByName("p2")[0].innerHTML="hello,world!"
alert('here')
}
</script>
getElementsByName在有些浏览器会有问题 最好不要用
</head>
<body>
<p id="p1" name="p1">Hello</p>
<button onclick="changeName()">改变名字并输出</button>
</body>
</html>