<table width="357" height="309" border="1">
<tr>
<td width="568"><input type="text" name="textfield" id="textfield" wlm_text="text_4" /></td>
<td width="38" colspan="2"> </td>
</tr>
<tr>
<td><input type="submit" name="button" id="button" value="提交" wlm_text="text_1" onclick="ok()"/></td>
<td width="38" colspan="2"> </td>
</tr>
<tr>
<td><input type="file" name="fileField" id="fileField" /></td>
<td width="38" colspan="2"> </td>
</tr>
</table>for (var i = 0; i< document.all.length;i++)
{e=window.event;
document.all[i].attachEvent('onmousedown',function(e){
if (e.button==2)
{i++;
alert(e.srcElement.tagName);}
});}每点击右键单独属性,会弹出好几个。我只想让他弹出一次,这个要怎么实现呢。高手帮帮我啊,累死我了。
window.onload = function(){
e=window.event;
document.body.attachEvent('onmousedown',function(e){
if (e.button==2){
alert(e.srcElement.tagName);}
});
}
for (var i = 0; i< document.all.length;i++)
{
e=window.event;
document.all[i].attachEvent('onmousedown',function(e){
if (e.button==2)
{i++;
alert(e.srcElement.tagName);
e.cancelBubble=true;
}
});
}
}