iamfm
01-15-2004, 03:35 PM
Hi all,
I'm attempting to create a script that can not only swap images but update the href value as well. I'm quite new to this so my scripting abilities are horrible. Below is a simple version of what I am trying to accomplish. So far this script works in IE6,NS7 for PC but no versions lower than this. Nor does it work in any Mac-based browser version. If anyone knows a better way to accomplish my goal, I would really appreciate any input.
Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript" type="text/JavaScript">
function newLocation() {
document.location.href="http://www." + adURL
}
</script>
<title>dynamic test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="460" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="300"> </td>
<td width="160"><a href="javascript:newLocation()"><img src="images/apples.jpg" name="fruit" width="160" height="160" border="0" id="fruit"></a></td>
</tr>
<tr>
<td width="300"> </td>
<td> </td>
</tr>
<tr>
<td width="300"> </td>
<td align="center" valign="bottom"><a href=# onClick="document.fruit.src='images/oranges.jpg';adURL='yahoo.com';">Swap</a></td>
</tr>
</table>
</body>
</html>
I'm attempting to create a script that can not only swap images but update the href value as well. I'm quite new to this so my scripting abilities are horrible. Below is a simple version of what I am trying to accomplish. So far this script works in IE6,NS7 for PC but no versions lower than this. Nor does it work in any Mac-based browser version. If anyone knows a better way to accomplish my goal, I would really appreciate any input.
Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript" type="text/JavaScript">
function newLocation() {
document.location.href="http://www." + adURL
}
</script>
<title>dynamic test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="460" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="300"> </td>
<td width="160"><a href="javascript:newLocation()"><img src="images/apples.jpg" name="fruit" width="160" height="160" border="0" id="fruit"></a></td>
</tr>
<tr>
<td width="300"> </td>
<td> </td>
</tr>
<tr>
<td width="300"> </td>
<td align="center" valign="bottom"><a href=# onClick="document.fruit.src='images/oranges.jpg';adURL='yahoo.com';">Swap</a></td>
</tr>
</table>
</body>
</html>