473,394 Members | 2,031 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.

Want to creat rollover image to larger

Hi,

I want to create this..

A 2 col table with 3 rows down.

In the 1st col I want three thumb size images, 1 in each row

When an image is rolled on, the larger image shows up in col 2

In other words when a thumb is rolled on, its larger image is shown in another
area of the table.

Any help please?

Can do the replace small image with larger okay, but they are in the same position.

I am trying to duplicate something like this..

http://cgi.ebay.com.au/ws/eBayISAPI....4288%26fvi%3D1
Thanks

Rock
Apr 22 '06 #1
10 4695
Hi Rock,

Following are two javascript functions that you will require:

<script language="javascript">
function showbigimage(colid, imgName)
{
document.getElementById(colid).innerHTML = "<img src='"+imgName+"'>";
}

function hidebigimage(colid)
{
document.getElementById(colid).innerHTML = "";
}
</script>

Here is the HTML table that you will want:

<table border=1>
<tr><td><img src=i1.jpg onmouseover='showbigimage("big1",
"i1_big.jpg")' onmouseout='hidebigimage("big1")'></td>
<td id='big1'></td></tr>
<tr><td><img src=i2.jpg onmouseover='showbigimage("big2",
"i2_big.jpg")' onmouseout='hidebigimage("big2")'></td>
<td id='big2'></td></tr>
<tr><td><img src=i3.jpg onmouseover='showbigimage("big3",
"i3_big.jpg")' onmouseout='hidebigimage("big3")'></td>
<td id='big3'></td></tr>
</table>

Hope this helps

Thanks and God Bless!!

Ehsan
http://ehsan.bdwebwork.com

Apr 22 '06 #2
Thanks Ehsan,

Appreciate the trouble you went to.

It is what I wanted. Now to look at the code so I can understand it.

Regards,

Rock

in OZ.
Ehsan wrote:
Hi Rock,

Following are two javascript functions that you will require:

<script language="javascript">
function showbigimage(colid, imgName)
{
document.getElementById(colid).innerHTML = "<img src='"+imgName+"'>";
}

function hidebigimage(colid)
{
document.getElementById(colid).innerHTML = "";
}
</script>

Here is the HTML table that you will want:

<table border=1>
<tr><td><img src=i1.jpg onmouseover='showbigimage("big1",
"i1_big.jpg")' onmouseout='hidebigimage("big1")'></td>
<td id='big1'></td></tr>
<tr><td><img src=i2.jpg onmouseover='showbigimage("big2",
"i2_big.jpg")' onmouseout='hidebigimage("big2")'></td>
<td id='big2'></td></tr>
<tr><td><img src=i3.jpg onmouseover='showbigimage("big3",
"i3_big.jpg")' onmouseout='hidebigimage("big3")'></td>
<td id='big3'></td></tr>
</table>

Hope this helps

Thanks and God Bless!!

Ehsan
http://ehsan.bdwebwork.com

Apr 22 '06 #3
ASM
Rock a écrit :
Hi,

I want to create this..

A 2 col table with 3 rows down.

In the 1st col I want three thumb size images, 1 in each row

When an image is rolled on, the larger image shows up in col 2


is it difficult because you need to pre-charge all images

best way would to have all images on the page
some of then styled in invisible

<style type="text/css">
#visual img { position:absolute; visibility: hidden;}
img#bigest { position: relative }
#visual img.show { visibility: visible }
</style>
<script type="text/javascript">
function hidImages() {
var P = document.getElementById('visual').getElementsByTag Name('IMG');
for(var i=0;i<P.length;i++) P[i].className = '';
}
function showImage(pictIndex) {
var P = document.getElementById('visual').getElementsByTag Name('IMG');
P[pictIndex-1].className = 'show';
}
</script>

<table>
<tr>
<td>
<img src="thumb/p1.jpg"
onmouseover="showImage(1)" onmouseout="hidImages()">
<img src="thumb/p2.jpg"
onmouseover="showImage(2)" onmouseout="hidImages()">
<img src="thumb/p3.jpg"
onmouseover="showImage(3)" onmouseout="hidImages()">
</td>
<td id="visual">
<img src="photos/p1.jpg">
<img src="photos/p2.jpg" id="bigest">
<img src="photos/p3.jpg">
</td>
</tr>
</table>

in this example your bigest image would be photos/p2.jpg
and you give to it the id 'bigest'
to arrange size of the td to this size
--
Stephane Moriaux et son [moins] vieux Mac
Apr 22 '06 #4
Hi Stephane,

Setting out "visiblity" property will occupy the space even the image
is not being shown/kept hidden, i.e. in the column even if the image is
hidden it will still show the YxY space occupied (width and height of
the image). I think setting "display" property instead will be fine, if
Rock wants to play around with CSS. Am I right?

<style type="text/css">
#visual img { position:absolute; display: none;}
img#bigest { position: relative }
#visual img.show { display: inline }
</style>

Thanks,

Ehsan

Apr 22 '06 #5
ASM
Ehsan a écrit :
Hi Stephane,

Setting out "visiblity" property will occupy the space
but as images are in absolute, they would occupy same space
(not more space than bigest image with its own style)

on my idea : visibility is a correct use here
<style type="text/css">


perhaps would it miss :

#virtual { position: relative; }

--
Stephane Moriaux et son [moins] vieux Mac
Apr 22 '06 #6
Hi Stephane,

Can you please check out the following two links. One is using your
code, I have only changed the filenames and added a table border. And
one is using your code but display property. You will see the second
column on visibility.html shows a space (i.e. the size of image(s) it
contains. On the other hand display.html does not show the space
occupied.

Please write your views on it.

On display.html I have changed the following line:

#visual img { position:absolute; visibility: hidden;}

to

#visual img { position:relative; display: none;}

Making absolute to relative.

http://ehsan.bdwebwork.com/tests/visibility.html
http://ehsan.bdwebwork.com/tests/display.html

Thanks,

Ehsan

Apr 22 '06 #7
ASM
Hi Ehsan,

you're right :-(
this css are sometimes suprising ...
#visual img { position:relative; display: none;}

http://ehsan.bdwebwork.com/tests/display.html
is much more most better.

http://ehsan.bdwebwork.com/tests/visibility.html


could run but 'visual' containing all big images
would have to be a div inside the td
and we lost somme TD's automatisms in centrage (centering?)
--
Stephane Moriaux et son [moins] vieux Mac
Apr 22 '06 #8
There are few more suprises with CSS, even with "display" property. I
have seen, if you set a "display" property for <td> and toggle with
showing the <td> and hidding it, eventually it keeps creating a space
before the <td> space. When it hides a small space before the cell gets
created. If you anyway have to hide the whole <td>, you must start
another table inside the td and set property for the <table> tag.

Anyway if you (Stephane) or anyone else comes up with a solution to
"visibility" property, please post it here.

Thanks and God Bless!!

Ehsan
http://ehsan.bdwebwork.com

Apr 23 '06 #9
ASM
Ehsan a écrit :
There are few more suprises with CSS, even with "display" property. I
have seen, if you set a "display" property for <td>
css for TABLEs TRs and TDs are special
you don't use {display: block} to get them back

http://www.w3.org/TR/CSS21/indexlist.html#index-t
http://www.w3.org/TR/CSS21/tables.ht...def-table-cell

Important :
http://www.w3.org/Style/CSS/
http://www.w3.org/TR/CSS21/

Bookmark this :
http://www.w3.org/TR/CSS21/indexlist.html
and put it in your browser's buttons bar
Anyway if you (Stephane) or anyone else comes up with a solution to
"visibility" property, please post it here.
it is not only a question of visibility, but of positionning too

http://stephane.moriaux.perso.wanado...visibility.htm
http://stephane.moriaux.perso.wanado...ty_variant.htm
Thanks and God Bless!!


I think God is for nothing about miraculous css :-)
--
Stephane Moriaux et son [moins] vieux Mac
Apr 23 '06 #10
Great, thanks for the information.

Ehsan

Apr 23 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Matt | last post by:
i know more-or-less zero about javascript, but my client wants a rollover and he created this code, which doesn't work. All comments are appreciated. 1. the tag: <td align="center" width="66"...
6
by: AJBopp | last post by:
I'm wrestling with CSS variations between Firefox and IE. I'm trying to create rollover buttons in a menu frame. It is working perfectly in Firefox but in IE only the first button is properly...
2
by: Rob Roberts | last post by:
I am trying to figure out a way to add onmouseover and onmouseout events to ButtonFields in a GridView in order to give them a rollover effect, but so far I haven't been able to figure out a way to...
3
by: Rob R. Ainscough | last post by:
Just curious why a VERY commonly used affect of rollover was NOT implemented in .NET 2.0 for web controls? Does anyone have a link to VB code that will show me how to build my own UserControl...
4
by: Dan | last post by:
Hi, I know how to make a rollover image in java, but I have trouble when my photo is a php document like: photo_resize.php? id=2&amp;resize_width=600&amp;resize_height=466 Does anyone know how to...
2
by: Casimir | last post by:
I am looking into making pure CSS image rollovers. Do you have any clever (and robust) CSS rollover-tricks? Or links to such "in the wild"? I have figured out two methods for this, but have...
2
by: eholz1 | last post by:
Hello CSS and StyleSheet members, I have decided to move away from Dreamweaver javascript rollover buttons, in favor of a CSS type rollover button. (hope that is ok). I plan to use PHP to...
8
by: Dave Rado | last post by:
Hi Roderik On 15 Apr, 23:44, Roderik <nos...@atall.nlwrote: The image's position is defined relative to the right hand edge of the text, and depending on the what fonts the user has...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.