href=";javascript:proDoc(……不能在chrome上工作,但是IE
我想问两个问题href=";javascript:proDoc(……不能在chrome上工作,但是IE,javascript,Javascript,我想问两个问题 如何使用? “Word DownLoad1”在JSFIDLE.net中不起作用 “Word DownLoad2”在IE中可用,但在chrome中不可用。为什么? html 在铬上测试: <span id="GridView1_ctl04_lblWord"> <select id='selPdf56' class='selectMenu'> <option value='g38' >A Form</option>
在铬上测试:
<span id="GridView1_ctl04_lblWord">
<select id='selPdf56' class='selectMenu'>
<option value='g38' >A Form</option>
<option value='g39' >B Form</option>
</select></span>
<a id="GridView1_ctl04_lnkWord" href="javascript:proDoc('56','g38');">Word DownLoad1</a>
<a id="GridView1_ctl05" href="javascript:proDoc(56,document.getElementById('selPdf56').options[document.getElementById('selPdf56').selectedIndex].value);">Word DownLoad2</a>
表格
B表格
这里的工作小提琴:实际上,您没有使用id
selPdf56
,但是有name
和class
,您使用了getElementById
,这就是它不起作用的原因,在jsFiddle
中,您选择运行脚本onload
,但您应该选择将其保留在标题中>标签
HTML
<span id="GridView1_ctl04_lblWord">
<select name='selPdf56' id='selPdf56' class='selectMenu'>
<option value='g38' >A Form</option>
<option value='g39' >B Form</option></select>
</span>
<a id="GridView1_ctl04_lnkWord" href="javascript:proDoc('56','g38');">Word DownLoad1</a>
<a id="GridView1_ctl05" href="javascript:proDoc(56,document.getElementById('selPdf56').options[document.getElementById('selPdf56').selectedIndex].value);">Word DownLoad2</a>
在JSFIDLE中,将包装设置更改为“无包装”,请参见“惊奇!谢谢lot@weilun,不客气:-)
<span id="GridView1_ctl04_lblWord">
<select id='selPdf56' class='selectMenu'>
<option value='g38' >A Form</option>
<option value='g39' >B Form</option>
</select></span>
<a id="GridView1_ctl04_lnkWord" href="javascript:proDoc('56','g38');">Word DownLoad1</a>
<a id="GridView1_ctl05" href="javascript:proDoc(56,document.getElementById('selPdf56').options[document.getElementById('selPdf56').selectedIndex].value);">Word DownLoad2</a>
<span id="GridView1_ctl04_lblWord">
<select name='selPdf56' id='selPdf56' class='selectMenu'>
<option value='g38' >A Form</option>
<option value='g39' >B Form</option></select>
</span>
<a id="GridView1_ctl04_lnkWord" href="javascript:proDoc('56','g38');">Word DownLoad1</a>
<a id="GridView1_ctl05" href="javascript:proDoc(56,document.getElementById('selPdf56').options[document.getElementById('selPdf56').selectedIndex].value);">Word DownLoad2</a>
function proDoc(myDEID,myForm){
alert(myDEID +' '+ myForm);
}