Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Javascript string comparison?
Closed Thread
Old 11-16-2005, 02:31 PM   #1 (permalink)
 
True Techie

Join Date: Oct 2005

Posts: 109

Shocker

Default Javascript string comparison?

Hey All,

I need some help with my javascript program. I need to write a program that diplays an image, and when clicked, it changes to a different image. And when you click on the 2nd image, it changes back to the 1st, and so on. I got the program to switch to the 2nd image, but can't get it to switch back. My instructor gave us a hint that we have to use string comparison? I've looked all through the book and w3schools, but can't find anything. Please help! What piece of code am I missing? Here's what I have so far:

<html>
<head>

<title>Javascript Assignment 4 Part 3</title>

<script language = "Javascript">

// Blue Jacket: http://www.newenough.com/product_pic...blue_front.jpg

// Red Jacket: http://www.newenough.com/product_pic.../red_front.jpg



//The function is called when the image in the body is clicked.
//The function changes the image source of 'Blue Jacket' to 'Red jacket'

function rollover ()


{
document.picture.src = "http://www.newenough.com/product_pictures/a/alpinestars_tz1_jacket/red_front.jpg";
}


</script>
</head>
<body>

<h1>Welcome to Switching Images!</h1>


<!-- there is an image tag below with the name picture that displays 'Blue Jacket'.
When the image is clicked, the 'rollOver()' function is called -->







</body>
</html>
Shocker is offline  
Old 11-16-2005, 09:50 PM   #2 (permalink)
 
True Techie

Join Date: Oct 2005

Posts: 109

Shocker

Default

C'mon people, 21 views and no replies yet
Shocker is offline  
Old 11-24-2005, 04:51 AM   #3 (permalink)
 
True Techie

Join Date: Oct 2005

Posts: 109

Shocker

Default

bump
Shocker is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On