HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 30th, 2004, 01:33 PM
veronica2468 veronica2468 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: United Kingdom
Posts: 4 veronica2468 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Paragraph - text swap

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

Reply With Quote
  #2  
Old May 4th, 2004, 05:26 AM
bhupi_dhami bhupi_dhami is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 6 bhupi_dhami User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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>

Reply With Quote
  #3  
Old June 20th, 2004, 07:04 AM
Iconoklast Iconoklast is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 Iconoklast User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Paragraph - text swap


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT