Menu
Can someone tell me how I can change a picture when the mouse is put over another smaller picture?
I’ve seen this done in loads of places, but am not sure how it’s done.
Thanks.
Jam
<i>
</i><img name="myImage" src="image1.gif" ...
onmouseover="document.images['myImage'].src='image2.gif';return true;"
onmouseout="document.images['myImage'].src='image1.gif';return true;"
<i>></i>
[i]Originally posted by gumbystation [/i]
[B]...there are many others...[/B][/QUOTE]
[i]Originally posted by jammer20002 [/i]
[B]what i wanted was to have 4 small thumbnail images across the top, and one big image below this.
what i want is to have the big image change when the mouse is put over the thumbnail images.
i'd like to do it the 'most' recommended way.
if that involves css... then i'd like to do it using that.[/B][/QUOTE]
[i]Originally posted by jammer20002 [/i]
[B]also... i'm confused about how to preload images for the above effect.
is preloading recommended at all?
in anycase, i'm confused as to how i can have the images load into the actual page without them showing?[/B][/QUOTE]
<i>
</i>var tempImage = new Image();
tempImage.src = "myImage.jpg";
[i]Originally posted by jammer20002 [/i]
[B]this might sound stooopid, but i think i had the answer to my question anyway. ?
i've previously used this code:
function setText(text)
{
var obj = document.getElementById("msg");
obj.innerHTML = text;
}
i then have variables ...
[B]is the above javascript or css?[/B]
thanks. [/B][/QUOTE]
[i]Originally posted by gumbystation [/i]
[B]...you can to it with CSS, it's hard to create but easy to maintain.[/B][/QUOTE]
[i]Originally posted by jammer20002 [/i]
[B]what i wanted was to have 4 small thumbnail images across the top, and one big image below this.
what i want is to have the big image change when the mouse is put over the thumbnail images.[/B][/QUOTE]
[i]Originally posted by MstrBob [/i]
[B][font=trebuchet ms][COLOR=royalblue]As would be I. At this point, we're going beyond CSS. CSS's purpose is to style a document. When you're using elments to change another element, you're changing the value of that other element. You're changing it's source. That realm belongs to scripting, in which you manipulate the data via the DOM.[/COLOR] [/font] [/B][/QUOTE]
[i]Originally posted by gumbystation [/i]
[B]--[URL=http://www.simplebits.com/bits/minitabs.html]Here is an example[/URL] using CSS.
-- The documenting of it is[URL=http://www.simplebits.com/notebook/2003/06/07/mini_tabs_the_untab_tab.html]here[/URL] .
It sounds like you guys thought I was lying to you. I'm not here to start trouble. ? I'm just trying to give him many options. Just in case he decided in the future to change things up! [/B][/QUOTE]
<i>
</i><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Content-Style-Type" content="text/css">
<meta http-equiv="content-script-type" content="text/javascript">
<title></title>
<script type="text/javascript">
<!--
function change(pic)
{
document.getElementById('jpic').src=pic;
}
function revert()
{
document.getElementById('jpic').src='pic0.jpg';
}
// -->
</script>
</head>
<body>
<ul>
<li onmouseover="change('pic1.jpg');" onmouseout="revert();">Hover 1</li>
<li onmouseover="change('pic2.jpg');" onmouseout="revert();">Hover 2</li>
<li onmouseover="change('pic3.jpg');" onmouseout="revert();">Hover 3</li>
<li onmouseover="change('pic4.jpg');" onmouseout="revert();">Hover 4</li>
</ul>
<img src="pic0.jpg" alt="" id="jpic">
</body>
</html>
[/COLOR][/font][i]Originally posted by phpnovice [/i]
[B]Perhaps you overstated/mis-stated yourself? [/B][/QUOTE]
[i]Originally posted by MstrBob [/i]
[B][font=trebuchet ms][COLOR=royalblue]The commercials aren't so good thus far. Why don't people seem to understand this, the OP wants to change a picture that is [B]different[/b] from the element that's being hovered over. So, you hover over a link, and a DIFFERENT image changes. How would you accomplish that with CSS?[/COLOR] [/font] [/B][/QUOTE]
0.1.9 — BETA 5.28