Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ swap image help :)

Posted by: jyrkz Sep 12 2006, 05:08 PM

hi all biggrin.gif im new here.. tongue.gif

im using dreamweaver 8

at left side i got "text" right side "image"
here is what i cant do... if i press on "text" i want image on right side to swap with other image smile.gif
it should be easy but i cant handle it blush.gif

and is it possible to swap "table id" ?tongue.gif

Posted by: Christian J Sep 12 2006, 05:15 PM

Hi! smile.gif

QUOTE
if i press on "text" i want image on right side to swap with other image


This can't be done with only HTML, you must use e.g. javascript. Unless DW contains such a script you'll have to search the web for one, or write one yourself.

QUOTE
and is it possible to swap "table id" ?


You mean, change the ID of a table? Yes that can be done with javascript too.

Posted by: jyrkz Sep 12 2006, 05:17 PM

could some1 gimme some code or smth smile.gif plsss biggrin.gif tongue.gif

in table i got "text+image"(right side) so if i press on "text"(left side) i want it to swap to diffrent "text+image" (right side)

Posted by: Darin McGrew Sep 12 2006, 05:53 PM

QUOTE
if i press on "text" i want image on right side to swap with other image
QUOTE(Christian J @ Sep 12 2006, 03:15 PM) *
This can't be done with only HTML, you must use e.g. javascript.
FWIW, here's http://meyerweb.com/eric/css/edge/popups/demo2.html (but no JavaScript).

Posted by: CodeKing Sep 12 2006, 07:42 PM

QUOTE
if i press on "text" i want image on right side to swap with other image


function swapImage(ID,src)
{
document.getElementsById(ID).src = src;
}

<a href="java script: swapImage('myImage','http://www.mysite.com/image.gif');">Swap image!</a>

QUOTE
and is it possible to swap "table id" ?


function swapTableId(oldID,newID)
{
document.getElementsById(oldID).id = newID;
}

<a href="java script: swapTableID('myTable','newTable');">Swap table ID!</a>

(Try that. I'm not sure if it'll work.)

CodeKing

dry.gif sad.gif smile.gif biggrin.gif tongue.gif angry.gif mad.gif blink.gif blush.gif

Posted by: Darin McGrew Sep 13 2006, 12:49 AM

Just a quick comment on the href="java script:..." links: It's better to use the onclick event handler, and to put a real URL in the href attribute.

Posted by: Frederiek Sep 13 2006, 02:07 AM

In addition to the link Darin gave: to swap an image AND text, then go see http://meyerweb.com/eric/css/edge/popups/demo3.html from Eric Meyer.

Posted by: Christian J Sep 13 2006, 09:25 AM

QUOTE(Darin McGrew @ Sep 13 2006, 12:53 AM) *

QUOTE
if i press on "text" i want image on right side to swap with other image
QUOTE(Christian J @ Sep 12 2006, 03:15 PM) *
This can't be done with only HTML, you must use e.g. javascript.
FWIW, here's http://meyerweb.com/eric/css/edge/popups/demo2.html (but no JavaScript).


True, but that only works while the mouse hovers, not permanently like when you click. If that's an important distinction is another issue.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)