473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MouseOver Image sizes????

Is there a (Simple) way to make the image produced by the mouseover command - to be a specific size? I have several different pictures - and depending on what it is the size can vary alot - is there anyway to make the mouseover command dictate that the image is 50% of its original size - so that it automatically adjusts to each picture being displayed?

Example of what I mean about the pictures:






Right now when the mouseover action takes place - the displayed image is 371 X 580 which really distorts the 2nd image.

Just looking for a "prettier" way to do this.

Thanks!

Sophie
Aug 12 '08 #1
3 1356
acoder
16,027 Expert Mod 8TB
If you preload the images, e.g.
Expand|Select|Wrap|Line Numbers
  1. var img = new Image();
  2. img.src = "theURL.png";
then you can get the height and width of the images, with the img.height and img.width properties.
Aug 12 '08 #2
I am very green at this Java - where exactly would I put this code? - I have tried dictating what the height and width would be - but it hasn't worked yet.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <a onmouseover="MAINIMG('393LOGI5')" href="http://i157.photobucket.com/albums/t58/olivas_enterprises/393LOGI5.jpg" alt="OLIVAS ENTERPRISES" width = "182" height = "151">
  3.        <img border="0" src="http://i157.photobucket.com/albums/t58/olivas_enterprises/393LOGI5.jpg" width="82" height="51"></A>
  4.  
  5.  
I want the MAINIMG to be correctly sized. Right now it is a standard size based on the main image - but my images are not all the same size so many of them get stretched and skewed funny.

Thanks again for your assistance! and sorry for the delay getting back to you.
Aug 31 '08 #3
acoder
16,027 Expert Mod 8TB
Put the earlier code in the head. Then in the MAINIMG function, get the corresponding pre-loaded image variable to work out its height/width. From that you can work out what height and width to set the img tag to.
Aug 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: richk | last post by:
For some reason when I add additional buttons a 3rd button and beyond i cant get the effect to work and I get errors...I cant understand why... <SCRIPT LANGUAGE = "javascript"><!-- if...
14
by: J. Makela | last post by:
Hallo. This should be a pretty entertaining question for you *real* javascript writers.. I, being the lowly photoshop guy at an ad agency made the mistake of actually saying "HTML" in a...
4
by: murrayatuptowngallery | last post by:
I have looked at some mouseover/ sound object scripts and can't get them to work. Most were more complex than needed and introduced several new parameters for me. I found a simple pair of html...
2
by: Amy | last post by:
<style> div.helpBtn{ font:bold 73% verdana; color:#995F8D; text-align:left; width:79px; height:24px; margin:0px; padding: 5px 0px 0px 27px; background:...
3
by: Annette Acquaire | last post by:
I have and image map with a dozen hotspot links on it that I'm trying to get to open a new image over existing one on mouseover of each COORD. The only thing I was able to do was swap image on...
23
by: Schannah | last post by:
I'm trying to create a design which mimics the Radiohead website in the action on this page, but the problem is that they use PHP for the effect and I have no idea about PHP. I'm very amateur: fairly...
1
by: dave345 | last post by:
This javascript issue is in an app using C# / .Net 2.0 running on XP. First post, please mention if I mess up any conventions of this forum. I’ve got a mouseover event that only works properly...
0
by: spacecadet563 | last post by:
I am trying to change and display the image source of an image control (named image2 )on mouseover of cell event on a gridview(Gridview1) with a SQL datasource. The cell contains image name of image...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.