div显示的时候显示a0 a1 a2这样内容后加上div的序列号 <div>a</div><div>a</div><div>a</div>显示的时候显示a0 a1 a2这样内容后加上div的序列号。 js咋整一下。请教。 解决方案 » 免费领取超大流量手机卡,每月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 runat="server"> <title>Untitled Page</title> <script> var name=0 function show() { var x=Math.floor(Math.random()*1160); var y=Math.floor(Math.random()*800); var mp=document.getElementById("a"); var s="<div style='height:100px; width:100px; border:2 px; background-color:Red; left:"+x.toString()+"px; top: "+y.toString()+"px; z-index:500; position:absolute' id=div"+name.toString()+"><input id=but"+name.toString()+" onclick=endit(div"+name.toString()+") type='button' value='关闭' />DIV_"+name.toString()+"郁闷啊^_^</div>"; mp.insertAdjacentHTML("beforeEnd",s); name++; } function endit(o) { var b=o.id; var mp=document.getElementById("a"); mp.removeChild(o); } </script></head><body> <form id="form1" runat="server"> <div id="a"> <input id="Button1" type="button" value="button" onclick="show()" /> </div> </form></body></html> <div>a</div> <div>a</div> <div>a</div><script>var div=document.getElementsByTagName("div");for(var i=0;i<div.length;i++){ div[i].innerHTML+=i }</script> document.getElementById(id) 和 直接用id做变量的区别 kineditor怎么修改文件上传的大小 在JS中关于遍历“checkbox” 一排 span 都是 白色背景 点击的这个变红色 别的还原成白色 这段js代码要实现的功能是什么,涉及到google的jsapi。 JavaScript延时执行function JS操作COOKIE 有什么办法实现XP风格的下拉框? 动态增加表格问题 急:站内搜索的相对路径或绝对路径的问题 判断远程图片是否存在的问题! 怎样动态通过按钮添加一个table 中的tr和td呢!
<!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 runat="server">
<title>Untitled Page</title>
<script>
var name=0
function show()
{
var x=Math.floor(Math.random()*1160);
var y=Math.floor(Math.random()*800);
var mp=document.getElementById("a");
var s="<div style='height:100px; width:100px; border:2 px; background-color:Red; left:"+x.toString()+"px; top: "+y.toString()+"px; z-index:500; position:absolute' id=div"+name.toString()+"><input id=but"+name.toString()+" onclick=endit(div"+name.toString()+") type='button' value='关闭' />DIV_"+name.toString()+"郁闷啊^_^</div>";
mp.insertAdjacentHTML("beforeEnd",s);
name++;
}
function endit(o)
{
var b=o.id;
var mp=document.getElementById("a");
mp.removeChild(o); }
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="a">
<input id="Button1" type="button" value="button" onclick="show()" />
</div>
</form>
</body>
</html>
<div>a</div>
<div>a</div>
<script>
var div=document.getElementsByTagName("div");
for(var i=0;i<div.length;i++){ div[i].innerHTML+=i }
</script>