corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » javascript anyone???


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author javascript anyone???
yzf-r6 (stella Man)
Member

Registered: 16th Nov 03
Location: Northampton
User status: Offline
19th Jan 04 at 11:35   View User's Profile U2U Member Reply With Quote

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
19th Jan 04 at 15:00   View User's Profile U2U Member Reply With Quote

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]

 
New Topic

New Poll

Corsa Sport » Message Board » Off Day » javascript anyone??? 23 database queries in 0.0064909 seconds