Forum Moderators: open

Message Too Old, No Replies

<div id="gag"> sizing

         

Sothpaw

1:15 pm on Jun 28, 2007 (gmt 0)

10+ Year Member



i have a series of images that when hovered over change a main picture. the main pic is controlled by JavaScript and positioned and sized by CSS.
<div id="gag" class="gag">
so far the main pic doesn't size at all. it becomes the size of the base image. i would like to change that to a specific % but can only get CSS to control the base image.
how do i control the image sizes from JavaScript.
the only JavaScript tutorials i can find talk nothing about image sizing.

vincevincevince

1:20 pm on Jun 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am having trouble understanding the question - can you try to clarify it?

From javascript, you can use the .style.width and .style.height properties of an element, e.g.:

document.getElementById('gag').style.width='100px';

Sothpaw

2:31 pm on Jun 28, 2007 (gmt 0)

10+ Year Member



i guess what i mean is...
where do i put the width element in JavaScript and how would it look.
i'm new to JavaScript coding. i have a strong handle on HTML and CSS but i'm working off of our old webmasters code and it looks like he got this JavaScript code free from some free ware site.
the lines of code pertaining to specific images look like this.

//Specify image paths and optional link (set link to "" for no link):
var dynimages=new Array()
dynimages[1]=["001.jpg", ""]
dynimages[2]=["002.jpg", ""]

and my HTML looks like:
</div>
<div id="dynloadarea" class="dynloadarea">
<img src="001.jpg" border="0" width="100%">
</div>

only the 001.jpg loads as 100% width. once i roll over a different icon and the main image changes to 002 it scales to the original width of the picture and going back to 001 is original also. i want all the images to be a specific width but can't find JavaScripting tutorials about image sizing.