Embedding JavaScript Function Call within String Parameter? (-|-)

  • From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 2 Nov 2007 16:26:24 -0700

Anyone have any ideas about this? How do you embed a javascript function call within a string parameter?


For instance, I first have the link...

<a id="linkElementID" href="#" onclick="UnHideText(); return false;"> Toggle show hidden text </a>

Then the functions
<script>
function UnHideText() {
linkElementID.onclick = 'HideText(); return false;';
// Function to show the text...
}
function HideText() {
linkElementID.onclick = 'UnHideText(); return false;';
// Function to hide the text again...
}
</script>

Each time the link element is clicked, it should reset the onclick to trigger the appropriate function. It doesn't appear to work though, the embedded function
call within the string doesn't look to work.

Thanks,

Bryan
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: