1 Replies - 5953 Views - Last Post: 04 October 2006 - 01:52 PM

#1 aerook  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 20-September 06

Javascript SRC in head of HTML not working.

Posted 04 October 2006 - 01:43 PM

Im making a Javascript Hangman, and i'm trying to use a library to store all of my functions. In the head of the index page, i have this:

<head>
<script type="text/javascript">
	src="hangman.js";
</script>
<title>Hangman</title>
</head>



Inside the hangman.js file, I have this line:

function makeWord()



When I try to call the function (which generates a random integer, and then picks a word from many based on the number), the editor (and Firefox) tell me that in the call line,

 word = makeWord(); 


"makeWord is not defined"...have I done something wrong???

Is This A Good Question/Topic? 0
  • +

Replies To: Javascript SRC in head of HTML not working.

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Javascript SRC in head of HTML not working.

Posted 04 October 2006 - 01:52 PM

Your problem is here:
<script type="text/javascript">
	src="hangman.js";
</script>



Source should be inside the script tag, not between the script tags.

<script type="text/javascript" src="hangman.js">	
</script>


Also, please post HTML/Javascript questions in the HTML/CSS/Javascript forum. Thanks.

Someone want to move this to the proper forum. Thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1