Menu
I am trying to create an image swap without using JavaScript. Can anyone help to get this code to work? Thanx a million!
[code]
<a href=”MyFile.htm” target=”Main”
onmouseover=”01.src=’IMG/imageA.gif'”;
onmouseout =”01.src=’IMG/imageB.gif'”;
onclick =”01.src=’IMG/imageA.gif'”>
<img name=”01″ src=”IMG/imageA.gif'” border=”0″></a>
Cheers, Jochem ?
<i>
</i><style type="text/css">
.01_on {background-image:url("IMG/imageA.gif");}
.01_off {background-image:url("IMG/imageB.gif");}
</style>
<td class="01_off"
onmouseover="this.className='02_on'"
onmouseout ="this.className='02_off'"
onclick ="this.className='02_on'">
<a href="MyFile.htm" target="Main">
<img src="IMG/Void.gif" border="0"></a></td>
[i]Originally posted by jochem [/i]
[B]image swap without using JavaScript. [/B][/QUOTE]
<i>
</i><td><a href="MyFile.htm" target="Main"
onmouseover="document.images['01'].src='IMG/imageA.gif'";
onmouseout ="document.images['01'].src='IMG/imageB.gif'";
onclick ="document.images['01'].src='IMG/imageA.gif'">
<img name="01" src="IMG/imageB.gif" border="0"></a></td>
<style type="text/css">
a#rollover {
display: block;
height: 67px;
width: 200px;
background-image: url(images/rolldemo_off_small.gif);
}
a#rollover:hover {
background-image: url(images/rolldemo_on_small.gif);
}
span#rollover_preload {
background-image: url(images/rolldemo_on_small.gif);
}
</style>
</head>
<body>
<span id="rollover_preload"><a href="http://www.infinitypages.com" id="rollover"></a></span>
<i>
</i><style type="text/css">
#menu01 a {width:14px; height:13px; background-image:url("IMG/imageA.gif")}
#menu01 a:hover {width:14px; height:13px; background-image:url("IMG/imageB.gif")}
#menu01 a:active{width:14px; height:13px; background-image:url("IMG/imageB.gif")}
</style>
<td id="menu01"><a href="MyFile.htm" target="Main"><img src="IMG/Void.gif" border="0"></a></td>
span#rollover_preload {
display: block;
height: 67px;
width: 200px;
background-image: url(images/rolldemo_on_small.gif);
}
<i>
</i><HTML>
<HEAD>
<style type="text/css">
a#01 {width:14px; height:13px; background-image:url("IMG/image01A.gif"); display:block}
a#01:hover {width:14px; height:13px; background-image:url("IMG/image01B.gif"); display:block}
a#01:active {width:14px; height:13px; background-image:url("IMG/image01B.gif"); display:block}
span#01_preload {width:14px; height:13px; background-image:url("IMG/image01B.gif"); display:block}
a#02 {width:14px; height:13px; background-image:url("IMG/image02A.gif"); display:block}
a#02:hover {width:14px; height:13px; background-image:url("IMG/image02B.gif"); display:block}
a#02:active {width:14px; height:13px; background-image:url("IMG/image02B.gif"); display:block}
span#02_preload {width:14px; height:13px; background-image:url("IMG/image02B.gif"); display:block}
</style>
</HEAD>
<BODY bgcolor="#ffffff">
<div style="position:absolute; top:5px; left:10px; padding:0px">
<span id="01_preload"><a href="PageOne.htm" target="Main" id="01"></a></span>
<span id="02_preload"><a href="PageTwo.htm" target="Main" id="02"></a></span>
</div>
</BODY>
</HTML>
<i>
</i>td#01_preload {width:14px; height:13px; background-image:url("IMG/image01B.gif"); display:block}
td#02_preload {width:14px; height:13px; background-image:url("IMG/image01B.gif"); display:block}
<td id="01_preload"><a href="PageOne.htm" target="Main" id="01"></a></td>
<td id="02_preload"><a href="PageTwo.htm" target="Main" id="02"></a></td>
<head>
<style type="text/css">
#links {position:absolute; visibility:visible; top:17px; left:12px; z-index:2; padding:0px;}
#descriptions {position:absolute; visibility:visible; top:2px; left:10px; z-index:1; padding:0px; width:205px; height:26; border:1px solid #64646e;}
a:hover span {position:absolute; visibility:visible; top:-14px; left:3px; z-index:1; padding:0px; width:200px; height:26; display:block;}
a:hover {font:9pt Verdana,Arial; font-weight:normal; color:#0099ff; text-decoration:none;}
a span {display:none;}
.preload {display:none;}
#01 a {width:14px; height:13px; background-image:url("01a.gif");}
#01 a:hover {width:14px; height:13px; background-image:url("01b.gif");}
#01 a:active {width:14px; height:13px; background-image:url("01b.gif");}
#02 a {width:14px; height:13px; background-image:url("02a.gif");}
#02 a:hover {width:14px; height:13px; background-image:url("02b.gif");}
#02 a:active {width:14px; height:13px; background-image:url("02b.gif");}
</style>
</head>
<body>
<img src="01b.gif" class="preload"/>
<img src="02b.gif" class="preload"/>
<i> </i><div id="descriptions">&nbsp;</div>
<i> </i><div id="links">
<i> </i> <table border="0" cellspacing="4" cellpadding="0">
<i> </i> <tr><td id="01"><a href="MyFile1.htm" target="Main"><img src="Void.gif" border="0"/><span>menu item 1</span></a></td>
<i> </i> <td id="02"><a href="MyFile2.htm" target="Main"><img src="Void.gif" border="0"/><span>menu item 2</span></a></td>
<i> </i> </tr></table>
<i> </i></div>
</body>
[i]Originally posted by jochem [/i]
I want to avoid using JavaScript because some 13% of all browsers can't read it or have it disabled.[/QUOTE]
[i]Originally posted by Thomas2 [/i]
[B]This is not what my statistics indicate:
I am running a Javascript/PHP page logging script for my 5 websites (a NOSCRIPT option calls the PHP script here if Javascript is disabled).
This shows that 93-97% of users have Javascript enabled. [/B][/QUOTE]
[i]Originally posted by Paul Jr [/i]
[B]I believe the 13% is a web-wide statistic, individual sites may differ. [/B][/QUOTE]
[i]Originally posted by Thomas2 [/i]
[B]You might therefore actually be shooting yourself in the foot by using a CSS solution for something that can be done with Javascript. [/B][/QUOTE]
[i]Originally posted by Thomas2 [/i]
[B]By the way, about 10% of people are surfing the net with images disabled[/B][/QUOTE]
[i]Originally posted by pyro [/i]
[B]
<style type="text/css">
a#rollover {
display: block;
height: 67px;
width: 200px;
background-image: url(images/rolldemo_off_small.gif);
}
a#rollover:hover {
background-image: url(images/rolldemo_on_small.gif);
}
span#rollover_preload {
background-image: url(images/rolldemo_on_small.gif);
}
</style>
</head>
<body>
<span id="rollover_preload"><a href="http://www.infinitypages.com" id="rollover"></a></span>
http://www.infinitypages.com/research/cssrollover.htm - not much to look at, as it was just a test, but the code is there, so you can see it working. [/B][/QUOTE]
<style type="text/css">
span#rollover_preload {
background-image: url(images/rolldemo_on_small.gif);
}
a#rollover {
display: block;
height: 67px;
width: 200px;
background-image: url(images/rolldemo_off_small.gif);
}
a#rollover:hover {
background-image: url(images/rolldemo_on_small.gif);
}
a#rollover img {
display: none;
}
</style>
</head>
<body>
<span id="rollover_preload"><a href="http://www.infinitypages.com" id="rollover"><img src="images/rolldemo_off_small.gif" alt="" /></a></span>
0.1.9 — BETA 6.1