944,168 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 861
  • ASP.NET RSS
Nov 6th, 2009
0

Using Javascript in seperate file.

Expand Post »
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.

html Syntax (Toggle Plain Text)
  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:

javascript Syntax (Toggle Plain Text)
  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??
Similar Threads
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
RunTimeError is offline Offline
54 posts
since Oct 2009
Nov 6th, 2009
0
Re: Using Javascript in seperate file.
Forgot that you need script references in the header. Duh.

HTML Syntax (Toggle Plain Text)
  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>
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
RunTimeError is offline Offline
54 posts
since Oct 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: IE can not display the web page ..?
Next Thread in ASP.NET Forum Timeline: Urgent:Encryption





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC