What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » JavaScript Help

JavaScript Help
Author: Message:
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
O.P. JavaScript Help
Hi All,

I have an image (lets say ImageA) and when its clicked i want it to change to ImageB.

But then if ImageB is clicked it goes back to ImageA.

I know how to chnage the image the first time, but not sure how to check if its already been changed to choose which image to change it too.

I think i need to set a boolean value to keep track, but i don't know much javascript so can someone help?
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
04-05-2005 04:31 PM
Profile E-Mail PM Web Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: JavaScript Help
code:
function changepic ()
if (document.Image.src =="path to image a") {
document.Image.src = "path to image b";
}
else{
document.Image.src = "path to image a";
}


code:
onclick="document.image.src = changepic(); return false;"


something like that?

This post was edited on 04-05-2005 at 04:36 PM by Stigmata.
04-05-2005 04:35 PM
Profile PM Web Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
O.P. RE: JavaScript Help
[n00b mode]  do i have to change Image to the image name?  [/n00b mode]
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
04-05-2005 04:43 PM
Profile E-Mail PM Web Find Quote Report
Joe
Senior Member
****

Avatar

Posts: 950
Reputation: 30
36 / Other / Flag
Joined: Mar 2004
RE: JavaScript Help
"path to image a"

fill that in with the path to the image and do the same with the other ones

This post was edited on 04-05-2005 at 04:47 PM by Joe.
[Image: holidayssigei2.jpg]
04-05-2005 04:47 PM
Profile E-Mail PM Find Quote Report
TheGeek
Full Member
***

Avatar
Excuse my geekyness.

Posts: 179
Reputation: 15
34 / Male / –
Joined: Feb 2005
RE: JavaScript Help
html:
code:
<img src="image1.gif" id="Image" onclick="document.image.src = changepic(); return false;">

javascript:
code:
function changepic ()
if (document.Image.src =="path to image a") {
document.getElementByID("Image").src = "path to image b";
}
else{
document.getElementByID("Image").src = "path to image a";
}

I'm a little bit rusty on the JS, but i think it should be like this.

This post was edited on 04-05-2005 at 04:54 PM by TheGeek.
[Image: 468x60banner.png]
04-05-2005 04:48 PM
Profile E-Mail PM Web Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
O.P. RE: JavaScript Help
yea ive chnage the paths, but i wasnt sure if i have to change
code:
docuemnt.image.src
to
code:
docuement.imagename.src
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
04-05-2005 04:49 PM
Profile E-Mail PM Web Find Quote Report
TheGeek
Full Member
***

Avatar
Excuse my geekyness.

Posts: 179
Reputation: 15
34 / Male / –
Joined: Feb 2005
RE: JavaScript Help
i don't think docuement.imagename.src will work...
[Image: 468x60banner.png]
04-05-2005 04:53 PM
Profile E-Mail PM Web Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: JavaScript Help
:) yes

also if its in a table etc you need to add its name after document
04-05-2005 04:54 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On