fork download
  1. <form name=fm>
  2. <input type=search name=k size=60> <br>
  3. <button type=submit name=ggl>Google</button>
  4. <button type=submit name=yho>Yahoo! Japan</button>
  5. </form>
  6.  
  7. <div style="display:none"><!--見せない-->
  8. <form name=subggl method=get target=_blank action="http://w...content-available-to-author-only...o.jp/search">
  9. <input type=text name=q><a href="http://w...content-available-to-author-only...o.jp/" target=_blank>top</a></form>
  10.  
  11. <form name=subyho method=get target=_blank action="http://s...content-available-to-author-only...o.jp/search">
  12. <input type=text name=p><a href="http://w...content-available-to-author-only...o.jp/" target=_blank>top</a></form>
  13. </div>
  14.  
  15. <script>
  16. addEventListener('load', function(){ var _=0;
  17. function searchOnNewTab(name, v) {
  18. var form = document.forms['sub' + name];
  19. if (v === '') {
  20. form.getElementsByTagName('A')[0].click()
  21. } else {
  22. form.getElementsByTagName('INPUT')[0].value = v;
  23. form.submit();
  24. }
  25. }
  26. document.forms['fm'].addEventListener('click', function(ev){
  27. if (ev.target.type != 'submit') return;
  28. ev.preventDefault();
  29. var form = ev.currentTarget;
  30. var name = ev.target.name;
  31. var valu = form.elements['k'].value;
  32. searchOnNewTab(name, valu);
  33. }, false);
  34. }, false)
  35. </script>
  36.  
Runtime error #stdin #stdout #stderr 0.36s 381888KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
js: "prog.js", line 16: syntax error
js: addEventListener('load', function(){ var _=0;
js: ........................................^
js: "prog.js", line 34: syntax error
js: }, false)
js: ^
js: "prog.js", line 35: unterminated regular expression literal
js: </script>
js: ........^
js: "prog.js", line 1: Compilation produced 3 syntax errors.