-1

I want to ask 2 questions.

  1. How to use http://jsfiddle.net/? "Word DownLoad1" is not work in jsfiddle.net???

  2. "Word DownLoad2" is work in IE, but it is not work in chrome.Why? html.

    <span id="GridView1_ctl04_lblWord">
      <select name='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> 
    

js

function proDoc(myDEID,myForm){
       alert('Active');
}


http://jsfiddle.net/3pZ2M/7/

weilun
  • 53
  • 1
  • 13

2 Answers2

1

Actually, you did not use an id selPdf56 but there was name and class and you used getElementById that's why it didn't work and in the jsFiddle you chose to run the script onload but you should have chosen to keep it in the head tags.

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>

JS

function proDoc(myDEID,myForm){
   alert(myDEID +' '+ myForm);
}

WORKING DEMO.

The Alpha
  • 143,660
  • 29
  • 287
  • 307
0

Tested on Chrome:

 <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>

Working fiddle here: http://jsfiddle.net/3pZ2M/9/

Hackerman
  • 12,139
  • 2
  • 34
  • 45