<script>
alert(dv.all.tags("INPUT")[0]);
</script>
<div id=dv><input type="button"><input type=button1></div>
alert(dv.all.tags("INPUT")[0]);
</script>
<div id=dv><input type="button"><input type=button1></div>
解决方案 »
- 求一段由加减乘除构成的自动变化的计数器
- 怎么用js控制页面100%显示
- 求助,关于js滚动图片
- 判断包含&号的字符是否相等的问题
- onclick="javascript:alert('abc')"跟onclick="alert('abc')"什么区别?
- 显示日期的javascript疑问
- 高手来,寻高效表格排序算法
- javascript怎么实现电影结束后演员表向上滚动效果。
- 子页面关闭时如何让父页面执行一次pageload,而不是reload()一次
- 发送请求的时候遇到provisional headers are shown 导致请求发不出去
- 怎样让 “sp_”+i 变成 "sp_4"对象呢?
- 操作XML字串(在线)
<input type="button" onclick="mm(this)">
<input type="button" onclick="mm(this)">
<input type="button" onclick="mm(this)">
<input type="button" onclick="mm(this)">
<input type="button" onclick="mm(this)">
<input type="button" onclick="mm(this)">
</div><SCRIPT LANGUAGE="JavaScript">
function mm(e)
{
var a = e.parentElement.children;
for(var i=0; i<a.length; i++)
if(a[i]==e) alert("你是点击了第 "+ (i+1) +" 个按钮!");
}
</SCRIPT>
bar = document.getElementById("divname");
for(var i=0;i<5;i++)
{
item = bar.appendChild(document.createElement("button");
item.onmouseover="function()" 请问在function中怎么获取button的索引?
}
for(var i=0;i<5;i++)
{
item = bar.appendChild(document.createElement("button");
item.onmouseover="function("+ i +")";// 请问在function中怎么获取button的索引?
}