Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML image swap

Status
Not open for further replies.

rissac

Technical User
May 9, 2003
79
IN
Hello, I can't seem to get the thumb nail images to swap out the bigger image. What is want is everytime you roll over a thumbnail the bigger image changes. Does any one have any suggestions? There is a link below. Thanks.




Serge Eustache
 
Do you know of any good sources for javascript of css for what I'm trying to do?

Serge Eustache
 
Thanks for your help.

Serge Eustache
 
My results actually came through with a little script provided below. And it works great. Thank you all for your help.



Plcae this part inside your head tags change your image source in this part. (including width and height)
==============================================================

<script language="javascript">
//script found on //all credit to unknown author
<!-- hide script from old browsers

window.onerror = null;

var netscape = 0;
var goodIE = 0;
browserName = navigator.appName.substring(0,8);
browserVer = parseFloat(navigator.appVersion);
if (browserName == "Netscape" && browserVer >= 3)
{ netscape = 1; }
if (browserName == "Microsof" && browserVer >= 4)
{ goodIE = 1; }
// end error trapping code


if (netscape || goodIE) {

pic1 = new Image(150,100);
pic1.src = "default.gif";
pic2 = new Image(150,100);
pic2.src = "firstswap.gif";
pic3 = new Image(150,100);
pic3.src = "secondswap.gif";

a1 = new Image(100,50);
a1.src = "upbutton1.gif";
a2 = new Image(100,50);
a2.src = "downbutton1.gif";
b1 = new Image(100,50);
b1.src = "upbutton2.gif";
b2 = new Image(100,50);
b2.src = "downbutton2.gif";
}

function hiLite(imgDocID, imgObjName, imgDocID2, imgObjName2) {
if (netscape || goodIE) {
document.images
.src = eval(imgObjName + ".src");
document.images
.src = eval(imgObjName2 + ".src");

}}

//end hiding -->
</script>

====================================================
place these parts where you want your images to show
=====================================================
big image
----------------------------------------
<img SRC="default.gif" NAME="pic" ALT="Default Image" height=100 width=150>
----------------------------------------
buttons
----------------------------------------
<a href="your-page.html" onMouseOver="hiLite('pic','pic2','a','a2'); window.status='Button 1';return true;" onMouseOut="hiLite('pic','pic1','a','a1'); window.status='';return true;" onclick="window.focus()"><img SRC="upbutton1.gif" NAME="a" ALT="Button 1" BORDER=0 height=50 width=100></a>
<a href="your-page.html" onMouseOver="hiLite('pic','pic3','b','b2'); window.status='Button 2';return true;" onMouseOut="hiLite('pic','pic1','b','b1'); window.status='';return true;" onclick="window.focus()"><img SRC="upbutton2.gif" NAME="b" ALT="Button 2" BORDER=0 height=50 width=100></a>





Serge Eustache
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top