Using Javascript in seperate file.

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2009
Posts: 31
Reputation: RunTimeError is an unknown quantity at this point 
Solved Threads: 3
RunTimeError RunTimeError is offline Offline
Light Poster

Using Javascript in seperate file.

 
0
  #1
20 Days Ago
I'm trying to do something very simple...just access a JavaScript function that exists in a separate file but I can't seem to get it to work.

  1. <form id="form1" runat="server">
  2. <script type="text/javascript" src="styleScript.js"></script>
  3. <div id="container" class="container">
  4.  
  5. <button id="button1" onmouseover="mouseOver('button1')" style="margin-left:900px;width:200px;background-color:Transparent;height:100px;margin-top:120px;">About Me</button>
  6.  
  7. </div>
  8. </div>
  9. </div>
  10. </form>

My styleScript.js class:

  1. function mouseOver(var b)
  2. {
  3. //do stuff
  4. }

Is there anything I need to do to have my html access this javascript function that exists in a separate file??
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 31
Reputation: RunTimeError is an unknown quantity at this point 
Solved Threads: 3
RunTimeError RunTimeError is offline Offline
Light Poster
 
0
  #2
20 Days Ago
Forgot that you need script references in the header. Duh.

  1. <head runat="server">
  2. <title>Welcome</title>
  3. <link rel="stylesheet" type="text/css" href="style.css" />
  4. <script type="text/javascript" src="styleScript.js">
  5. </script>
  6. </head>
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC