/    Sign up×
Community /Pin to ProfileBookmark

image help please

hi. i’m trying to have an image change to match with the id of the selected option. What i’d like it to eventually do is when i click the button ‘back’, it’ll take the value and subtract one from it and change the photo to go with the new id and vise-versa with ‘next’. can anybody help me??

this is my code so far

[code=php]
<html>

<head>
<title>test</title>
</head>

<body><center>
<p><image name=’pic1′></p>
<input type=”button” value=”Back” onClick=”fun();”>
<select name=’name’ onChange=”change(selectedIndex);”>
<option id=’next’ value=1>next</option>
<option id=’back’ value=2>back</option>
</select>
<input type=”button” value=”Next” onClick=”fun();”>
<script languange=”javascript”>
function fun()
{
alert(“hi”);
}
function change(selectedIndex)
{
document.images[‘pic1’].src =name.options[selectedIndex].id + ‘.jpg’;
window.status=name.options[selectedIndex].id;
}
</script>
</center></body>

</html>
[/code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@cupofjoeauthorMar 12.2005 — can anyone help?
Copy linkTweet thisAlerts:
@cupofjoeauthorMar 14.2005 — problem solved!

incase anyone would like to see the solution, it can be found [url=http://www.codingforums.com/showthread.php?t=54327]here[/url]
×

Success!

Help @cupofjoe spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...