怎样修改HTML标签的事件属性处理 <input id="test" type=button value="test" onclick="alert('1');"> <input type=button value="更改" onclick="aaa()"> <script> function aaa() { var test = document.getElementById("test"); test.onclick = function() {alert('2');} //放到函数里} </script> 解决方案 » 免费领取超大流量手机卡,每月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> <title>无标题页</title></head><body><input id="test" type=button value="test" onclick="alert('1');"> <input type=button value="更改" onclick="aaa()"> <script> function aaa() { var test = document.getElementById("test"); test.onclick = function(){alert("2")} } </script> </body></html>要用函数初始化 <input id="test" type=button value="test" buttonValue="1" onclick="alert(this.buttonValue);"> <input type=button value="更改" onclick="aaa()"> <script> function aaa() { var test = document.getElementById("test"); test.buttonValue = 2; } </script> <input id="test" type=button value="test" onclick="alert('1');"><input type=button value="更改" onclick="aaa()"><script>function aaa() {var test = document.getElementById("test");test.onclick = alertMe;}function alertMe(){ alert(2);}</script> 楼上都对<input id="test" type=button value="test" onclick="alert('1');"> <input type=button value="更改" onclick="aaa()"> <script> function aaa() { var test = document.getElementById("test"); test.onclick = new Function("alert('2');"); } </script> 页游的脚本是怎么写的,有这样的教程没? jquery datepicker控件的问题,请教各位 javascript求解释```` 屏蔽浏览器回退功能 jquery插件的问题,高手来 怎样指向当前对象 js调用txt并进行字符替换,如何操作?很急,盼复! 如何得到一个字符串的字节数? 求个模拟鼠标轨迹的函数 js中浮点数 0.1+0.7=0.7999999999…… 脚本广告的图片问题. 验证问题
<head>
<title>无标题页</title>
</head>
<body>
<input id="test" type=button value="test" onclick="alert('1');">
<input type=button value="更改" onclick="aaa()">
<script>
function aaa() {
var test = document.getElementById("test");
test.onclick = function(){alert("2")}
}
</script>
</body>
</html>要用函数初始化
<input type=button value="更改" onclick="aaa()">
<script>
function aaa() {
var test = document.getElementById("test");
test.buttonValue = 2;
}
</script>
<input type=button value="更改" onclick="aaa()">
<script>
function aaa() {
var test = document.getElementById("test");
test.onclick = alertMe;
}
function alertMe()
{
alert(2);
}
</script>
<input type=button value="更改" onclick="aaa()">
<script>
function aaa() {
var test = document.getElementById("test");
test.onclick = new Function("alert('2');");
}
</script>