|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi, I'm hoping someone can help me on this. I have a table with 2 cols. The 1st column contains hyperlinks, the 2nd column contains a paragraph of text. What I would like, is for the text in column 2 to change when the hyperlinks are clicked. I'm not very familiar with the DOM. (Btw, the hyperlinks are generated from ASP...so I'd prefer not to go the 'hidden div' route as there will be loads of links...). I have tried the following (simplified for demonstration here) but failed - is this sort of way possible?:
<tr> <td> <a onclick="document.getElementbyID("targettext").value='test'">Change text</a> </td> <td> <div id="targettext">Friends info</div> </td> </tr> Many thanks for any help you can give! Veronica |
|
#2
|
|||
|
|||
|
Try this
<html>
<head> <script language="javascript"> function clickLink(strName) { var ob = document.getElementById(strName); ob.innerHTML = "test"; } </script> </head> <body> <table> <tr> <td> <u><a onclick="clickLink('targettext')" title="Change text">change text</a></u> </td> <td> <div id="targettext">Friends info</div> </td> </tr> </table> </body> </html> |
|
#3
|
|||
|
|||
|
I was wondering if there was a way to use this same script, but have it change back to the original text on a second click? basically a toggle between texts?
|
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > Paragraph - text swap |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|