这样就 都执行了<!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>无标题文档 </title>
</head>
<script language="Javascript" type="text/JavaScript" defer="defer">
function show() {
var box,boxSubmit; box = document.getElementById("box"); boxSubmit = document.createElement("input");
boxSubmit.setAttribute("type","button");
boxSubmit.setAttribute("value","执行");
boxSubmit.onclick=function(){
alert("给我执行啊~!");
}
//boxSubmit.setAttribute("onClick","javascript:alert(\"给我执行啊~!\");"); box.appendChild(boxSubmit);
} </script>
<body onload="show();">
<div id="box"> </div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档 </title>
</head>
<script language="Javascript" type="text/JavaScript" defer="defer">
function show() {
var box,boxSubmit; box = document.getElementById("box"); boxSubmit = document.createElement("input");
boxSubmit.setAttribute("type","button");
boxSubmit.setAttribute("value","执行");
boxSubmit.onclick=function(){
alert("给我执行啊~!");
}
//boxSubmit.setAttribute("onClick","javascript:alert(\"给我执行啊~!\");"); box.appendChild(boxSubmit);
} </script>
<body onload="show();">
<div id="box"> </div>
</body>
</html>
解决方案 »
- javascript 自定义对象问题 排序问题!!!!!!!!!!!!!!!
- jQuery源码分析疑问,进
- js中如何将一个标准时间转换为unix时间戳
- 正则表达 替换 字符串中指定的字符(用字符本身加上第n次出现的n替换)
- 打印的问题
- 如何用javascript实现打印机属性设置
- ■■■各位大虾,怎么样让media player9 自动download并安装啊,求救啊!!!
- 請問:我可以在提交頁面時得到所有被選中的CHECKBOX嗎?
- 怎么判断按下的是哪个按钮??
- 网站上在一个固定的地方消息的滚动是怎么实现的?
- 【老规矩】生星了,散分
- JavaBean连接SQL2000数据库,报表控件打印源代码
<!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>无标题文档 </title>
</head>
<script language="Javascript" type="text/JavaScript" defer="defer">
function show() {
var box,boxSubmit; box = document.getElementById("box"); boxSubmit = document.createElement("input");
boxSubmit.setAttribute("type","button");
boxSubmit.setAttribute("value","执行"); boxSubmit.onclick=myOnclick;
box.appendChild(boxSubmit);
}
function myOnclick(){
alert("给我执行啊~!");
}</script>
<body onload="show();">
<div id="box"> </div>
</body>
</html>