Help - Search - Members - Calendar
Full Version: swap image help :)
HTMLHelp Forums > Programming > Client-side Scripting
jyrkz
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
Christian J
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.
jyrkz
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)
Darin McGrew
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 an example that uses CSS (but no JavaScript).
CodeKing
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
Darin McGrew
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.
Frederiek
In addition to the link Darin gave: to swap an image AND text, then go see this CSS exemple from Eric Meyer.
Christian J
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 an example that uses CSS (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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.