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
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...

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.


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

Other related posts: