By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,259 Members | 1,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,259 IT Pros & Developers. It's quick & easy.

funtion not defined error - external JS file, onClick issues

tpgames
100+
P: 785
External JS file's function crossWord is not defined. I checked the link and the code. Can not find my error. I thought I might be missing something obvious like a ";" or something, but nothing I've tried works.
Thanks! :D
I copied and pasted the direct link to external JS file in to my code to be sure that wasn't the issue.

Expand|Select|Wrap|Line Numbers
  1.  <link type="text/javascript" href="http://www.globalwritersclub.com/gaming/2/word/xw/fr/1a.js"> 
  2.  
The external JS file, with only the form value's #6-91 deleted, but the rest of the code is there.
Expand|Select|Wrap|Line Numbers
  1. function crossWord(){
  2. if (document.form.c1.value=="l"
  3.     && document.form.c2.value=="a"
  4.     && document.form.c3.value=="s"
  5.     && document.form.c4.value=="n"
  6.     && document.form.c5.value=="e"
  7. )
  8.   alert("All is correct!")
  9.  
  10. else {alert("Problem. Please check answers.")}
  11. }
  12.  
The html code that calls the function.
Expand|Select|Wrap|Line Numbers
  1. <input type="button" value="Check Puzzle" onClick="javascript: crossWord()">
The abbreviated html code from the page, showing the context.
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
  2. <html>
  3. <head>
  4. <LANG="UTF-8">
  5. <title> Final XW </title>
  6. <META http-equiv="expires" content="Thur, 1 March 2007 13:00:00 GMT">
  7. <META http-equiv="content-type" content="text/html";charset=utf-8">
  8. <link type="text/css" rel="stylesheet" href="/gaming/2/word/xw/xwcss/xw2.css"> 
  9. <link rel="shortcut icon" href="http://www.globalwritersclub.com/gwc.gif">
  10.  
  11. <link type="text/javascript" href="http://www.globalwritersclub.com/gaming/2/word/xw/fr/1a.js"> 
  12. </head>
  13.  
  14. <body onLoad="alert('Please use lower case only!')">
  15.  
  16. <table>
  17. <td><p class="pcenter">  &nbsp; &nbsp; &nbsp; <img src="http://www.globalwritersclub.com/gwc/img/linkbanner6.jpg" width="900px" height="4px" alt=""> </p></td></tr>
  18.  
  19. <tr>
  20. <td>
  21. <table>
  22. <form name="form">
  23.  
  24. <tr>
  25. <td class="b1r40"> &nbsp; </td>
  26. <td class="b1r80"> 1</td>
  27. <td class="b1r120"> 2 </td>
  28. <td class="b1r160"> 3 </td>
  29. <td class="b1r200"> 4</td>
  30. <td class="b1r240"> 5 </td>
  31. <td class="b1r280"> 6</td>
  32. <td class="b1r320"> 7</td>
  33. <td class="b1r360"> 8</td>
  34. <td class="b1r400"> 9</td>
  35. <td class="b1r440"> 10</td>
  36. <td class="b1r480"> 11</td>
  37. <td class="b1r520"> 12</td>
  38. <td class="b1r560"> 13</td>
  39. <td class="b1r600"> 14</td>
  40. <td class="b1r640"> 15</td>
  41. <td class="b1r680"> 16</td>
  42. <td class="b1r720"> 17</td>
  43. <td class="b1r760"> 18</td>
  44. <td class="b1r800"> 19</td>
  45.  
  46. <tr><!-- laserviette-->
  47. <td class="b2r40"> 1</td>
  48. <td class="b2r80"> </td>
  49. <td class="b2r120"> </td>
  50. <td class="b2r160"><input type="text" name="c1" size="1"> </td>
  51. <td class="b2r200"><input type="text" name="c2" size="1"> </td>
  52. <td class="b2r240"><input type="text" name="c3" size="1"> </td>
  53. <td class="b2r280"><input type="text" name="c4" size="1"> </td>
  54. <td class="b2r320"><input type="text" name="c5" size="1"> </td>
  55. <td class="b2r360"><input type="text" name="c6" size="1"> </td>
  56. <td class="b2r400"><input type="text" name="c7" size="1"> </td>
  57. <td class="b2r440"><input type="text" name="c8" size="1"> </td>
  58. <td class="b2r480"><input type="text" name="c9" size="1"> </td>
  59. <td class="b2r520"><input type="text" name="c10" size="1"> </td>
  60. <td class="b2r560"><input type="text" name="c11" size="1"> </td>
  61. <td class="b2r600"> </td>
  62. <td class="b2r640"> </td>
  63. <td class="b2r680"> </td>
  64. <td class="b2r720"> </td>
  65. <td class="b2r760"> </td>
  66. <td class="b2r800"> </td>
  67.  
  68.  
  69. <tr><!-- e -->
  70. <td class="b3r40"> 2</td>
  71. <td class="b3r80"> </td>
  72. <td class="b3r120"> </td>
  73. <td class="b3r160"><input type="text" name="c12" size="1"> </td>
  74. <td class="b3r200"> </td>
  75. <td class="b3r240"> </td>
  76. <td class="b3r280"> </td>
  77. <td class="b3r320"> </td>
  78. <td class="b3r360"> </td>
  79. <td class="b3r400"> </td>
  80. <td class="b3r440"> </td>
  81. <td class="b3r480"> </td>
  82. <td class="b3r520"> </td>
  83. <td class="b3r560"> </td>
  84. <td class="b3r600"> </td>
  85. <td class="b3r640"> </td>
  86. <td class="b3r680"> </td>
  87. <td class="b3r720"> </td>
  88. <td class="b3r760"> </td>
  89. <td class="b3r800"> </td>
  90.  
  91.  
  92. <tr><!-- s l -->
  93. <td class="b4r40"> 3</td>
  94. <td class="b4r80"> </td>
  95. <td class="b4r120"> </td>
  96. <td class="b4r160"><input type="text" name="c13" size="1"> </td>
  97. <td class="b4r200"> </td>
  98. <td class="b4r240"> </td>
  99. <td class="b4r280"> </td>
  100. <td class="b4r320"> </td>
  101. <td class="b4r360"> </td>
  102. <td class="b4r400"> </td>
  103. <td class="b4r440"> </td>
  104. <td class="b4r480"><input type="text" name="c14" size="1"> </td>
  105. <td class="b4r520"> </td>
  106. <td class="b4r560"> </td>
  107. <td class="b4r600"> </td>
  108. <td class="b4r640"> </td>
  109. <td class="b4r680"> </td>
  110. <td class="b4r720"> </td>
  111. <td class="b4r760"> </td>
  112. <td class="b4r800"> </td>
  113.  
  114.  
  115. <tr><!-- labaignoire l -->
  116. <td class="b5r40"> 4</td>
  117. <td class="b5r80"><input type="text" name="c15" size="1"> </td>
  118. <td class="b5r120"><input type="text" name="c16" size="1"> </td>
  119. <td class="b5r160"><input type="text" name="c17" size="1"> </td>
  120. <td class="b5r200"><input type="text" name="c18" size="1"> </td>
  121. <td class="b5r240"><input type="text" name="c19" size="1"> </td>
  122. <td class="b5r280"><input type="text" name="c20" size="1"> </td>
  123. <td class="b5r320"><input type="text" name="c21" size="1"> </td>
  124. <td class="b5r360"><input type="text" name="c22" size="1"> </td>
  125. <td class="b5r400"><input type="text" name="c23" size="1"> </td>
  126. <td class="b5r440"><input type="text" name="c24" size="1"> </td>
  127. <td class="b5r480"><input type="text" name="c25" size="1"> </td>
  128. <td class="b5r520"> </td>
  129. <td class="b5r560"><input type="text" name="c26" size="1"> </td>
  130. <td class="b5r600"> </td>
  131. <td class="b5r640"> </td>
  132. <td class="b5r680"> </td>
  133. <td class="b5r720"> </td>
  134. <td class="b5r760"> </td>
  135. <td class="b5r800"> </td>
  136.  
  137. </form>
  138. </table>
  139. </td>
  140.  
  141. <tr><td class="lowerhalf">
  142. <table border="2" width="96%">
  143.  
  144. <tr><td colspan="3"><p class="lhc"><img src="http://www.globalwritersclub.com/gwc/img/linkbanner6.jpg" width="100%" height="4px" alt=""></p></td></tr>
  145.  
  146. <tr><td class="lhc">
  147. <input type="button" onClick="javascript: crossWord()"  value="Check Puzzle"></td>
  148. <td class="lhc"><input type="reset" value="Reset Puzzle"></td>
  149. <td class="lhc"><a href="/gaming/2/word/xwnav.html" class="blkn"> Crossword Navigation </td></tr>
  150.  
  151. <tr><td colspan="3"><p class="lhc"><img src="http://www.globalwritersclub.com/gwc/img/linkbanner6.jpg" width="100%" height="4px" alt=""></p></td></tr>
  152.  
  153. <tr><td colspan="3" class="lhl">
  154. <a href="http://www.globalwritersclub.com/gaming/2/word/xw/rules.html"> ? </a></td></tr>
  155.  
  156.  
  157. <tr><td colspan="3"><p class="lhc"><img src="http://www.globalwritersclub.com/gwc/img/linkbanner6.jpg" width="100%" height="4px" alt=""></p></td></tr>
  158. <tr><td class="lhc"> HORIZONTAL </td>
  159.  
  160. <td><p class="lhc"><img src="http://www.globalwritersclub.com/gwc/img/bulletx.gif" width="40px" height="36px" alt=""></p></td>
  161.  
  162. <td class="lhc"> VERTICAL </td>
  163. </tr>
  164.  
  165.  
  166. <tr>
  167. <td colspan="3"><p class="lhc"><img src="http://www.globalwritersclub.com/gwc/img/linkbanner6.jpg" width="100%" height="4px" alt=""></p></td></tr>
  168.  
  169. <tr><td class="lhl"> } 1 the towel </td>
  170. <td><p class="lhc"><img src="http://www.globalwritersclub.com/gwc/img/bulletx.gif" width="40px" height="36px" alt=""></p></td>
  171. <td class="lhl"> } 1 the cushion </td>
  172. </tr>
  173.  
  174. <tr><td class="lhl"> } 4 the bathtub </td>
  175. <td><p class="lhc"><img src="http://www.globalwritersclub.com/gwc/img/bulletx.gif" width="40px" height="36px" alt=""></p></td>
  176. <td class="lhl"> } 3 the bubbles </td>
  177. </tr>
  178.  
  179. <tr>
  180. <td colspan="3"><p class="lhc"><img src="http://www.globalwritersclub.com/gwc/img/linkbanner6.jpg" width="100%" height="4px" alt=""></p></td></tr>
  181.  
  182. </table>
  183. </td></tr>
  184. </table>
  185. </body>
  186. </html>
  187.  
Feb 4 '10 #1

✓ answered by Dormilich

I must have been blind for not noticing at once …

Expand|Select|Wrap|Line Numbers
  1. <link type="text/javascript" href="http://www.globalwritersclub.com/gaming/2/word/xw/fr/1a.js">
<link> is wrong. scripts are always loaded via <script>

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="http://www.globalwritersclub.com/gaming/2/word/xw/fr/1a.js"></script>

Share this Question
Share on Google+
4 Replies


Dormilich
Expert Mod 5K+
P: 8,639
a link would help more.
Feb 4 '10 #2

tpgames
100+
P: 785
The link
Its a crossword puzzle, with answers in french, but clues in english.
Feb 4 '10 #3

Dormilich
Expert Mod 5K+
P: 8,639
I must have been blind for not noticing at once …

Expand|Select|Wrap|Line Numbers
  1. <link type="text/javascript" href="http://www.globalwritersclub.com/gaming/2/word/xw/fr/1a.js">
<link> is wrong. scripts are always loaded via <script>

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="http://www.globalwritersclub.com/gaming/2/word/xw/fr/1a.js"></script>
Feb 5 '10 #4

tpgames
100+
P: 785
LOL I KNEW there was something very obvious I missed. Even I know that! I can't believe I wrote 'link' instead of 'script'. lol Thanks!
Feb 5 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.