473,394 Members | 2,052 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,394 software developers and data experts.

Increase Image Size

1
Hi,
I have tried to incorporate an image increase and decrease on mouseover from an earlier posting.
Can anyone help me do this with multiple images?

Here is the html page I have as a sample:

[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="date" content="2003-12-02T09:54:03+08:00" />
<meta http-equiv="imagetoolbar" content="no" />

<title>Dynamically enlarge image on mouseover and mouseout</title>

<style type="text/css">
body {margin:64px;}
#apDiv1 {
position:absolute;
left:361px;
top:161px;
width:186px;
height:144px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:306px;
top:127px;
width:300px;
height:164px;
z-index:1;
}
#apDiv3 {
position:absolute;
left:188px;
top:116px;
width:100px;
height:75px;
z-index:1;
}
#apDiv4 {
position:absolute;
left:387px;
top:113px;
width:100px;
height:75px;
z-index:2;
}
</style>


<script type="text/javascript">
// <![CDATA[
var glbInc, glbDec;

function decreaseSizeImage() // will get back to its normal default size
{
if(glbInc != null) {clearTimeout(glbInc); glbInc = null;};
if (document.getElementById("image1").height > 100)
{
document.getElementById("image1").height -= 30;
document.getElementById("image1").width -= 40;
glbDec = setTimeout("decreaseSizeImage()", 32);
};
}

function increaseSizeImage()
{
if(glbDec != null) {clearTimeout(glbDec); glbDec = null;};
if (document.getElementById("image1").height < 216)
{
document.getElementById("image1").height += 30;
document.getElementById("image1").width += 40;
glbInc = setTimeout("increaseSizeImage()", 32);
};
}
// ]]>
</script>

</head>

<body>
<div id="apDiv3"><a href="#" onmouseover="increaseSizeImage();"
onmouseout="decreaseSizeImage();"><img id="image2"
src="images/plastic/HDPE/HDPE COLOR.jpg" width="100" height="75" alt="color" id="image2" /></a></div>
<p>&nbsp;</p>
<div id="apDiv4"><a href="#" onmouseover="increaseSizeImage();"
onmouseout="decreaseSizeImage();"><img id="image1"
src="plastic/hdpe/HDPE Parts.JPG"
width="100" height="75" alt="Krusty is helpless" /></a></div>
<p>&nbsp;</p>

<p id="validation">&nbsp;</p>

</body></html>[/HTML]
Aug 26 '07 #1
2 4108
r035198x
13,262 8TB
Hi,
I have tried to incorporate an image increase and decrease on mouseover from an earlier posting.
Can anyone help me do this with multiple images?

Here is the html page I have as a sample:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="date" content="2003-12-02T09:54:03+08:00" />
<meta http-equiv="imagetoolbar" content="no" />

<title>Dynamically enlarge image on mouseover and mouseout</title>

<style type="text/css">
body {margin:64px;}
#apDiv1 {
position:absolute;
left:361px;
top:161px;
width:186px;
height:144px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:306px;
top:127px;
width:300px;
height:164px;
z-index:1;
}
#apDiv3 {
position:absolute;
left:188px;
top:116px;
width:100px;
height:75px;
z-index:1;
}
#apDiv4 {
position:absolute;
left:387px;
top:113px;
width:100px;
height:75px;
z-index:2;
}
</style>


<script type="text/javascript">
// <![CDATA[
var glbInc, glbDec;

function decreaseSizeImage() // will get back to its normal default size
{
if(glbInc != null) {clearTimeout(glbInc); glbInc = null;};
if (document.getElementById("image1").height > 100)
{
document.getElementById("image1").height -= 30;
document.getElementById("image1").width -= 40;
glbDec = setTimeout("decreaseSizeImage()", 32);
};
}

function increaseSizeImage()
{
if(glbDec != null) {clearTimeout(glbDec); glbDec = null;};
if (document.getElementById("image1").height < 216)
{
document.getElementById("image1").height += 30;
document.getElementById("image1").width += 40;
glbInc = setTimeout("increaseSizeImage()", 32);
};
}
// ]]>
</script>

</head>

<body>
<div id="apDiv3"><a href="#" onmouseover="increaseSizeImage();"
onmouseout="decreaseSizeImage();"><img id="image2"
src="images/plastic/HDPE/HDPE COLOR.jpg" width="100" height="75" alt="color" id="image2" /></a></div>
<p>&nbsp;</p>
<div id="apDiv4"><a href="#" onmouseover="increaseSizeImage();"
onmouseout="decreaseSizeImage();"><img id="image1"
src="plastic/hdpe/HDPE Parts.JPG"
width="100" height="75" alt="Krusty is helpless" /></a></div>
<p>&nbsp;</p>

<p id="validation">&nbsp;</p>

</body></html>
Moved to Javascript forum
Aug 27 '07 #2
phvfl
173 Expert 100+
Put an argument into the decreaseSizeImage and increaseSizeImage functions which passes in the ID of the object. This could be reduced further using the 'this' keyword to pass in the object.
Expand|Select|Wrap|Line Numbers
  1. function decreaseSizeImage(imgID) // will get back to its normal default size
  2. {
  3. if(glbInc != null) {clearTimeout(glbInc); glbInc = null;};
  4. if (document.getElementById(srcID).height > 100)
  5. {
  6. document.getElementById(srcID).height -= 30;
  7. document.getElementById(srcID).width -= 40;
  8. glbDec = setTimeout("decreaseSizeImage()", 32);
  9. };
  10. }
  11.  
  12. function increaseSizeImage(src)
  13. {
  14. if(glbDec != null) {clearTimeout(glbDec); glbDec = null;};
  15. if (document.getElementById(srcID).height < 216)
  16. {
  17. document.getElementById(srcID).height += 30;
  18. document.getElementById(srcID).width += 40;
  19. glbInc = setTimeout("increaseSizeImage()", 32);
  20. };
  21. }
  22.  
[HTML]
<body>
<div id="apDiv3"><a href="#" onmouseover="increaseSizeImage('image2');"
onmouseout="decreaseSizeImage('image2');"><img id="image2"
src="images/plastic/HDPE/HDPE COLOR.jpg" width="100" height="75" alt="color" id="image2" /></a></div>
<p>&nbsp;</p>
<div id="apDiv4"><a href="#" onmouseover="increaseSizeImage('image1);"
onmouseout="decreaseSizeImage('image1');"><img id="image1"
src="plastic/hdpe/HDPE Parts.JPG"
width="100" height="75" alt="Krusty is helpless" /></a></div>
<p>&nbsp;</p>
[/HTML]

PS Please use code tags to seperate your code as it makes the code easier to read. There is a guide here
Aug 27 '07 #3

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

Similar topics

38
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
4
by: Kenny | last post by:
I have been trying to write a script that will increase the size of and image when you mouse over it, and decrease it to original size, when you mouse out. After a couple of attempts, this is what...
12
by: Raja | last post by:
How to know the buffer size and increase buffer size in c++.
1
by: nrhayyal | last post by:
hi all, i am working on C++ on AIX machine. i am running one of my module which is built using 10+ user built libraries. i am getting St9bad_alloc exception. i came to know that this exception...
6
by: reb | last post by:
Hi, How do i increase the size of the array without losing the data of that array in c#? thanks
11
by: eomer | last post by:
My site is very small, and plain - it will mostly be text (for now). I have used a good mix of css in the design. With usability in mind I would like to add some specific functionality (with the...
2
by: msnews.microsoft.com | last post by:
Hi all I am working on an application for a touch screen terminal. I have placed a datagrid on the form and the user will select a row on the datagrid. I have increased the font size on the...
2
by: Irfan | last post by:
Hi, I have a datagridview and some Buttons on a form. When I drag the form down to increase its size at run time, i want the datagridview also to increase in size so that i can view all the data...
4
by: truptidalia | last post by:
Hi, I have added an image to my button. If I increase the size of the button, the image is visible in tile form. How do I stretch the image of the button. <input...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.