200 Posted July 24, 2012 Share Posted July 24, 2012 Hii , <HTML> <HEAD> <TITLE>CHANGING IMAGES....</TITLE> <SCRIPT Language="JavaScript"> if(document.images) rollover="yes"; else rollover="no"; if(rollover=="yes") { ....code } function imageSwitchOn(imagename) { ...... .... } } function imageSwitchOff(imagename) { ...... ........ } } </SCRIPT> </HEAD> <BODY> <H1>IMAGES......</H1><BR> <H3><I>place your mouse pointer on the picture</I></H3> <A onMouseOver="imageSwitchOn('img1')" onMouseOut="imageSwitchOff('img1')"> <IMG Alt="space" Height=200 Name="img1" Src="Images/man2.gif" Width="200" /></A> </BODY> </HTML> I have this javascript code which toggles the images on browser when mouse cursor is moved in and out . Now problem is I am novice & I dont understand the codes- 1)What does document.images mean? I mean what is its its implication? 2)In the anchor tag <A onMouseOver="imageSwitchOn('img1')" onMouseOut="imageSwitchOff('img1')"> ,where is the href?? Plz Help. Quote Link to comment https://forums.phpfreaks.com/topic/266177-changing-images/ Share on other sites More sharing options...
xyph Posted July 24, 2012 Share Posted July 24, 2012 It doesn't have a href, and it doesn't need one According to the W3, it's optional. If you'd like to give it one, it wouldn't hurt anything It will change the behaviour when clicked though http://www.w3.org/TR/html4/struct/links.html#h-12.2 document.images is a collection of all the images on the current page http://www.webreference.com/js/column1/object.html Quote Link to comment https://forums.phpfreaks.com/topic/266177-changing-images/#findComment-1364037 Share on other sites More sharing options...
200 Posted July 24, 2012 Author Share Posted July 24, 2012 Thanks for the reply and help. But what does if(document.images) do? Quote Link to comment https://forums.phpfreaks.com/topic/266177-changing-images/#findComment-1364074 Share on other sites More sharing options...
xyph Posted July 24, 2012 Share Posted July 24, 2012 Checks if the object exists before using it. If the browser doesn't support it, it turns roll-overs off. I don't see the point of using the eye-roll emoticon. The question you asked is BASIC programming logic (not unique to JavaScript) Quote Link to comment https://forums.phpfreaks.com/topic/266177-changing-images/#findComment-1364089 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.