RE: newbie jscript ?

by "tim booker" <timbooker(at)lineone.net>

 Date:  Fri, 3 Mar 2000 23:35:42 -0000
 To:  "'Roger Harness'" <magic32(at)jps.net>,
<hwg-techniques(at)hwg.org>
 In-Reply-To:  jps
  todo: View Thread, Original
Hi Roger,

Here's a fairly standard mouseover script that I use all the time.

In the <HEAD> of the document:

<SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
 <!--

// preload images

if (document.images)
 {
	pictureOneOff = new Image;
	pictureOneOff.src = 'picture_one_off.gif';
 }

// do the mouseover

function goMouseOver(imgName, imgMode)
 {
	if (document.images)
	 {
		document[imgName].src = eval(imgName + imgMode + ".src");
	 }
 }

 // -->
</SCRIPT>


Then, in the <BODY>, your linked image should look a bit like this:

<A HREF="one.html" onMouseOver="goMouseOver('pictureOne', 'On');"
onMouseOut="goMouseOver('pictureOne', 'Off');">
<IMG NAME="pictureOne" SRC="picture_on_off.gif">
</A>

E-mail me if you need more help with this script,

Tim





> -----Original Message-----
> From: owner-hwg-techniques(at)hwg.org
> [mailto:owner-hwg-techniques(at)hwg.org]On Behalf Of Roger Harness
> Sent: 03 March 2000 21:12
> To: hwg-techniques(at)hwg.org
> Subject: newbie jscript ?
>
>
> Hello again good folks,
>
> Does anyone have any nice *simple* resources on how to
> pre-load images for
> some basic jscript roll-overs? While I consider myself fairly
> confident/competent in HTML, I know next to nothing about
> javascript. I
> just used a pre-made script for the rollovers, and adapted
> them to my own
> images. Now I just need too pre-load 'em so my faithful
> viewer won't have
> that temporary moment of uncomfortable (visual) silence while
> a piece of my
> navigation turns from blue-ish to yellow.
>
> I DID try to research it some using the search engines, but
> none of the
> sites i found were simple enough for me to understand. The
> best I could
> find was at http://www.webreference.com/dhtml/column1/preload.html
>
> could anyone tell me how to implement this using picture1_off.gif
> picture1_on.gif picture2_off.gif etc?? Or again, point me in
> a direction?
> Sorry to ask such a novice-type question. I should probably
> try to become
> more knowledgable before trying to tackle this kind of stuff??
>
> Anyways, the page in question is as
> http://2webslingers.com/lifedesign/design3a.html
> (please ignore the page itself, its just a mock up for a
> potential client
> :)
>
> Any advice VERY much appreciated!
>
> Sincerely,
> Roger Harness
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA