Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 08-06-2009, 01:59 AM   #1 (permalink)
 
Newb Techie

Join Date: Aug 2009

Posts: 1

ebranes is on a distinguished road

Default Help with Javascript code

Hi there,

I'm sure someone can help me with this simple fix. I am putting a site together for a friend and I found a Javascript code that I'm using which basically causes an image to enlarge on mouse rollover.

The website, which I just started, is: Home 2

What I'm trying to do is get the larger image to appear a little more to the right than it currently does, so it is not right on top of the thumbnails.

I hope someone can tell me what code (and where) I need to add to accomplish this. I'm quite new at this so I really need specific instruction.

Thanks in advance for your help!

Here is the code for the onmouseover routine:

Code:
<head> 
<script language="JavaScript"> 
function showlargeimage(imgshow) 
{document.getElementById('image').src=imgshow;} 
function showlargeimage(imgshow) 
{document.getElementById('image').src=imgshow; 
document.getElementById('image').style.display='block'; 
} 



</script> 
</head> 
<body> 
<TABLE> 
<TR> 
<TD> 
<!--THUMBNAILS--> 
<img src="thumbnail1.jpg" onmouseover=showlargeimage('image1.jpg')><br> <br> 
<img src="thumbnail2.jpg" onmouseover=showlargeimage('image2.jpg')><br> <br> 
<img src="thumbnail3.jpg" onmouseover=showlargeimage('image3.jpg')><br> <br> 
<img src="thumbnail4.jpg" onmouseover=showlargeimage('image4.jpg')><br> <br> 
<img src="thumbnail5.jpg" onmouseover=showlargeimage('image5.jpg')><br> <br> 
</TD> 
<TD> 
<!--image SCREEN--> 
<img src='#' id='image'> 
<img src='#' id='image' style='display:none'>
</TD> 
</TR> 
</TABLE> 
</body>

ebranes is offline  
Old 08-06-2009, 08:21 AM   #2 (permalink)
Baez's Avatar
 

Join Date: Sep 2005

Location: Toronto, Canada

Posts: 5,466

Baez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of light

Default Re: Help with Javascript code

First I would use divs instead of tables. Then create a style sheet and make two id's. One for the thumbnails and one for the main picture.

So your style sheet would go something like:

Code:
#thumbs
{min-width: 200px;}

#main
{margin: 0 0 0 225px;}
That would place a 25 pixel gap in between your thumbnails on the left and the big picture on the right.
__________________

Baez is offline  
Old 08-08-2009, 12:14 PM   #3 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: Help with Javascript code

You need to preload those large images into the browser cache, so there is no delay when you hover over them.

Code:
<img src="image1jpg" style="display:none;" />
<img src="image2.jpg" style="display:none;" /> 
<img src="image3.jpg" style="display:none;" />
<img src="image4.jpg" style="display:none;" /> 
<img src="image5.jpg" style="display:none;" />

__________________

Need website help? PM me!
CrazeD is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript code & tutorials oldskool Programming Discussions 4 02-01-2009 05:20 PM
Using javascript to hide and unhide elements dynamically Osiris Programming Discussions 0 01-14-2009 08:56 PM
PHP: How to modify a downloaded JavaScript code and partly change the code within it? LincolnX Programming Discussions 4 01-25-2008 04:25 PM
NEED help with a Javascript code...(mouseover and stuff) Quintox Web Graphics, Design, Digital Images 7 05-02-2007 06:41 PM
JavaScript Botnet Code Leaked To Internet Osiris Virus - Spyware Protection / Detection 0 04-02-2007 09:05 PM