|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
help with tables and linking please.
alright, I figured this was a better place to ask this than the HTML forum. Anyway, I what I want to do shouldn't be all that difficult, I just need some help figuring it out.
I'm working in Dreamweaver and I want to make it so that clicking a link in one table will open an image in another table. I understand disjointed rollovers, but I don't want the image to change if I rollover the link, only if it's clicked. any help you guys could provide me would be appreciated. Thanks! |
|
#4
|
||||
|
||||
|
OK. Have a look at the code. If you checked the source earlier, look again (you might as well just look here) because I changed it a little to make it simpler.
There's some javascript and css to hide the divs. 'onclick' will hide all of the divs again and then display the one you specify. I added 'a {cursor:pointer;}' so that the hand appears over the links. Erm... that's it really. If you need to know anything else, just ask and I'll try my best to answer. <!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"> <head> <title>Climber-switch</title> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis" /> <style type="text/css"> <!-- body {background:white;} div {color:red; font-size:large; padding:10px;} a {cursor:pointer;} .visible {display:block;} .hidden {display:none;} --> </style> <script type="text/javascript"><!-- function switchImg(div) { var option=['wine','beer','whisky']; for(var i=0; i<option.length; i++) { obj=document.getElementById(option[i]); obj.className=(option[i]==div)? "visible" : "hidden"; } } //--> </script> </head> <body> <div><a onclick="switchImg('wine');">wine</a></div> <div><a onclick="switchImg('beer');">beer</a></div> <div><a onclick="switchImg('whisky');">whisky</a></div> <div id="wine" class="hidden"> <img src="wine.jpg" height="100" width="100" alt="wine" /> <p>This is some wine.</p> </div> <div id="beer" class="hidden"> <img src="beer.jpg" height="100" width="100" alt="beer" /> <p>This is some beer.</p> </div> <div id="whisky" class="hidden"> <img src="whisky.jpg" height="100" width="100" alt="whisky" /> <p>This is some whisky.</p> </div> </body> </html> (I wrapped 'code' tags around this before, but then half of the code mysteriously disappeared - I wonder if that usually happens...?) Cheers. |
|
#5
|
|||
|
|||
|
thanks for the help. I've kinda got it working. The text appears when I click on the link, but not the picture. I've made all the changes and created the pictures and it should work, but I'm still gettin the red x. Also, the cursor doesn't change into the glove when it passes over the text that's supposed to cause the picture and additional text to appear.
|
|
#6
|
||||
|
||||
|
Let me see what you have.
|
|
#7
|
|||
|
|||
|
It's kinda butchered, but these are the parts I cut out that have anything to do with the switchImg.
<script language="JavaScript" type="text/JavaScript"> <!-- function switchImg(i){ document.images["blank"].src = i; var option=['project.jpg']; for(var t=0; t<option.length; t++) { obj=document.getElementById(option[t]); obj.className=(option[t]==i)? "visible" : "hidden"; } } //--> </script> <td width="200" align="left" valign="top" style="font-size: 9px"><font color="#486095" face="Verdana, Arial, Helvetica sans-serif"><div><a onclick="switchImg('project.jpg');">project</a></div><br></td> <td width="400" align="left" valign="top" style="font-size: 9px"><font color="#486095" face="Verdana, Arial, Helvetica sans-serif"><img src="blank" alt="blank.jpg" name="blank" width="200" height="400" align="right" /> <div id="project.jpg" class="hidden">project.</div></font></td> |
|
#8
|
||||
|
||||
|
Please read my second post.
I changed the code to make it simpler but you don't seem to have noticed. The hand thing is there too. Last edited by BonRouge : November 24th, 2004 at 06:58 PM. |
|
#9
|
|||
|
|||
|
thanks. it works now!
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Web Design Help > help with tables and linking please. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|