homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Calling external JS files
How do I place JS WITHIN JS?
litmania com

 2:21 pm on May 19, 2001 (gmt 0)

I have a question related to calling external JS files.

I have the following code in a .JS file:

document.writeln('<a href=\"http://www.education.com\" TARGET=\"_BLANK\" TITLE=\"For an online directory of distance graduate programs, click here!\"> Click here!</a>');

It works perfectly...

I would like to add a mouseover command to it, i.e.:
onMouseOver="window.status='Click here now to visit Education.com!';return true" OnMouseOut="window.status='';return true"

I've used the correct slashes in the right places. However, it doesn't work; probably because I'm trying to place Javascript within Javascript.

How can I place the onMouseOver command in the code at the top of this page?

Thank you very much :)


Black Knight

 8:02 pm on May 19, 2001 (gmt 0)

The OnMouseOver is an attribute that has to go within the link, and so can't be made external to the page - it has to be within the link.

However, you can do a lot by 'naming' objects and having javascript that reacts to those named objects being changed or manipulated.

Black Knight

 8:54 pm on May 19, 2001 (gmt 0)

I answered this with code on the other thread about JS navigation links.

The following version works - it was just a question of your single quotation marks closing the writeIn before you were finished.

document.writeln('<a href="http://www.education.com" TARGET="_BLANK" TITLE="For an online directory of distance graduate programs, click here!" onMouseOver="window.status=' + "'Click here now to visit Education.com!'" + ';return true" OnMouseOut="window.status=' + "''" + ';return true"> Click here!</a>');

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved