yzf-r6 (stella Man)
Member
Registered: 16th Nov 03
Location: Northampton
User status: Offline
|
Right i got this uni assignment due in on friday and i havent a clue about javascript. Tried cutting and pasting bit but as you can see its a load of crap and dont work. All i need it to do is to change the picture displayed, on the fly, to whatever has been selected in the dropdown. Also gotta put a price against each one and display that in a text box. I just cant do it, anyone fancy a go?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Main_Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<h1 align="center">PC-MEGA-ONLINE</h1>
function update ()
{
if (document.Main_Page.CPU.selectedIndex == 1) document.cpupic.src = "badge_pentium.jpg";
if (document.Main_Page.CPU.selectedIndex == 2) document.cpupic.src = "badge_amd.gif";
}
</head>
<body>
<select name="CPU" id="CPU">
<option>Pentium</option>
<option>AMD</option>
</select></h1>
<image name="cpupic" src="badge_pentium.jpg">
</body>
</html>
|
Mikeboy
Member
Registered: 12th Jun 02
Location: Wiltshire Drives: SXi DTi
User status: Offline
|
code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Main_Page</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<h1 align="center">PC-MEGA-ONLINE</h1>
<SCRIPT LANGUAGE="JavaScript">
function update()
{
document.images.init.src=
document.cpupics.CPU.options[document.cpupics.CPU.selectedIndex].value
}
</script>
</head>
<body>
<form name="cpupics"><select name="CPU" onChange="update()">
<option selected value="badge_pentium.jpg">Pentium</option>
<option value="badge_amd.gif">AMD</option>
</select>
<img src="badge_pentium.jpg" name="init">
</body>
</html>
(Edit - Just put it in the quotes cos it mucked up on search board function)
[Edited on 21-02-2004 by Mikeboy]
edit, that aint helped
[Edited on 21-02-2004 by Mikeboy]
|