Web Hosting Talk







View Full Version : Java Code onmouseover different size??


mugzy0130
04-01-2004, 08:38 PM
How do i resize the image onmouseover? The image is small and I want to the image to increase size when you place the mouse over the image. Is it possible? here is the code I am currently using but I dont know where to place the new size info.


<a href="/images/viewsonic1.jpg" height="96" width="154" border="1" target="viewsonic"
onmouseover="maintool.src='/images/viewsonic3.jpg'; return true;"
onmouseout="maintool.src='/images/viewsonic3.jpg'; return true;">
<img src="/images/viewsonic3.jpg" height="96" width="154" border="0" name="maintool" id="maintool" alt="maintool"/>


This is my first post here am new, sorry if I posted it in the wrong board.

John[H4Y]
04-01-2004, 11:35 PM
Originally posted by mugzy0130
How do i resize the image onmouseover? The image is small and I want to the image to increase size when you place the mouse over the image. Is it possible? here is the code I am currently using but I dont know where to place the new size info.


<a href="/images/viewsonic1.jpg" height="96" width="154" border="1" target="viewsonic"
onmouseover="maintool.src='/images/viewsonic3.jpg'; return true;"
onmouseout="maintool.src='/images/viewsonic3.jpg'; return true;">
<img src="/images/viewsonic3.jpg" height="96" width="154" border="0" name="maintool" id="maintool" alt="maintool"/>


This is my first post here am new, sorry if I posted it in the wrong board. Try:


onmouseover="maintool.height=96*2; maintool.width=154*2;" onmouseout="maintool.height=96; maintool.width=154;"

You can replace the "*2"s with *1.5 or *3 (or replace the whole thing with a pixel size instead) for bigger or smaller images.

brianbloom
04-02-2004, 05:14 PM
Although note that some older browsers will not "reflow" the page, meaning whatever size the original image was, that's how big any replacements will be...

null
04-02-2004, 05:24 PM
mugzy0130

Java and JavaScript are different languages :)

mugzy0130
04-03-2004, 10:35 PM
thanks John[H4Y] worked great!