External Javascript and mouseovers
Ok I am not good at javascript at all, I can edit it and read it, but can't write it. Here is my dilemma. I am linking an external javascript and it is not working because it is saying that the "mouseover" function is not defined. I imagine this has to do with the "mouseover" attribute in the anchor tag. What must this read in order to pull it from an external script?
Right now an example anchor tag is
<A HREF="#"
ONMOUSEOVER="ReplaceImage('JS2', 'JS2', MouseOverState);"
ONMOUSEOUT="ReplaceImage('JS2', 'JS2', OriginalState);">
and my javascript is located at
/images/links/links.js
Thanks
Pimpin like a pimp with an electrofied pimpin machine!
Vincent Puglia posted this at 01:08 — 23rd February 2000.
They have: 634 posts
Joined: Dec 1999
Hi,
1) if you are using Netscape, it won't like all caps for onMouseOver
2)Where is the ReplaceImage code? Are you appending *.jpg/*.gif?
3) are you including the links.js file properly? (i presume that's where replaceImage is) <script language="javascript" src="/images/links/links.js"> (the first backslash implies the images directory is at the root directory of the server -- is that correct?)
Vinny GrassBlade: cut&paste javascript
Where the world once stood
the blades of grass cut me still
Ken Elliott posted this at 04:47 — 23rd February 2000.
They have: 358 posts
Joined: Jun 1999
Actually I didn't mean to put that extra slash in there, it is a second level folder. Would it be easier to reference it with a url or something? I will replace the onMouseOver and those, I should have known that. Actually I had it linked like this
<link ref="JavaScript" href="images/links/links.js">
but I noticed that you referenced it as <style type="javascript" href="images/links/link.js"> (</style> ). But that didn't work either. Do I have to reference it from the anchor tag? Like CSS? (class="links.js")?
Thanks for your help
VulKen
Pimpin like a pimp with an electrofied pimpin machine!
Vincent Puglia posted this at 01:06 — 24th February 2000.
They have: 634 posts
Joined: Dec 1999
Hi VulKen,
If you look back at my previous response, I wrote:
<script language='javascript' src="somefile.js"> </script>
If you are including a js file, it cannot have any html in it -- only javascript.
Vinny
------------------
GrassBlade: cut&paste javascript
Where the world once stood
the blades of grass cut me still
Ken Elliott posted this at 04:22 — 24th February 2000.
They have: 358 posts
Joined: Jun 1999
I don't have any html in the javascript. I have it linked just as you said, but the whenever I try the buttons it says the onmouseover is not defined. That is whay I was asking must I reference it somehow in the anchor tag? I guess this is a tricky subject or something...whenever I ask a question I usually get alot of responses. Thank you Vincent for your time.
VulKen
Pimpin like a pimp with an electrofied pimpin machine!
Vincent Puglia posted this at 02:01 — 25th February 2000.
They have: 634 posts
Joined: Dec 1999
Hi Vulken,
What's the url?
------------------
GrassBlade: cut&paste javascript
Lloyd Hassell posted this at 16:43 — 26th February 2000.
They have: 231 posts
Joined: Feb 2000
Just to make sure you have your JS file linked correctly, insert an alert message so you will know for sure if it works.
alert('foo');
You better give us that URL if you want more help.
------------------
Lloyd Hassell
[email protected]
http://go.to/hass
:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.