html - JavaScript Code wont execute when clicking link -


the code below supposed allow me click text link , starts javascript function. however, no reaction when click links. used tutorial me http://www.thesitewizard.com/archive/textsubmit.shtml

<html><body>  <head>   <script language="javascript" type="text/javascript">             function getdsh(selectedfield)              {                 document.results.dshtoprint.value = selectedfield;                 document.results.getelementbyid(selectedfield).disabled = false;                 document.results.submit();             }         </script>     </head>     <font size = '6' color = 'red'>loop 1 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('1-1');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 2 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('2-1');"> ##! test fail: /switchcard/testvoltagemargining </a></p>  <p><a href = "javascript:getdsh('2-2');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 3 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('3-1');"> ##! test fail: /switchcard/testvoltagemargining </a></p>  <p><a href = "javascript:getdsh('3-2');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 4 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('4-1');"> ##! test fail: /switchcard/testvoltagemargining </a></p>  <p><a href = "javascript:getdsh('4-2');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 5 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('5-1');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 6 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('6-1');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 7 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('7-1');"> ##! test fail: /switchcard/testvoltagemargining </a></p>  <p><a href = "javascript:getdsh('7-2');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 8 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('8-1');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 9 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('9-1');"> ##! test fail: /switchcard/testvoltagemargining </a></p>  <p><a href = "javascript:getdsh('9-2');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 10 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('10-1');"> ##! test fail: /switchcard/testvoltagemargining </a></p>  <p><a href = "javascript:getdsh('10-2');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 11 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('11-1');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 12 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('12-1');"> ##! test fail: /switchcard/testvoltagemargining </a></p>  <p><a href = "javascript:getdsh('12-2');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <p><a href = "javascript:getdsh('12-3');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 25gbase --allow-mix-speeds --ppm=2000000 </a></p>  <font size = '6' color = 'red'>loop 13 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('13-1');"> ##! test fail: /switchcard/testvoltagemargining </a></p>  <p><a href = "javascript:getdsh('13-2');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p>  <p><a href = "javascript:getdsh('13-3');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 25gbase --allow-mix-speeds --ppm=2000000 </a></p>  <form name = 'results' method = 'post' action = '/cgi-bin/developer/dsh-generator-d.py'>  <input type = 'hidden' name = '13-3' value = "[&quot;2015-07-03 14:46:00]" disabled>  <input type = 'hidden' name = 'dshtoprint' >  </form>  </body></html> 

is syntax error?

edit: when click on link, error: uncaught typeerror: document.results.getelementbyid not function

first of all, try using developer's console browser (likely shown "ctrl+shift+i").

for question: javascript case sensitive, "getelementbyid()" won't work; use "getelementbyid()" instead. also, won't work when calling document.[form].getelementbyid(), should call directly: document.getelementbyid(id). nevertheless, have no id's set in html, clicks return 'null' parameter in function.

i recommend try simpler examples first, particular one!


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -