Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Getting DHTML to let me use a javascript function for the URL

Question posted by: sdonohue (Newbie) on September 29th, 2006 02:46 AM
I am not very good at DHTML, but I have a set of links that use DHTML and they work :)

But now the customer wants to have one of my DHTML links call a javascript function when it is clicked on. When I put it into DHTML, it treats everything between the " " like a constant. When I remove the quotes, it gives me an error.

One of the versions I have tried is:

DQM_rollover_image12 = "/images/nav_hospital.gif"
DQM_rollover_wh12 = "208,20"
DQM_rollover_xy12 = "0,240"
DQM_url12 = "/index.html onClick=UTC_Hospital()"

the javascript function I am trying to call is in index.html and it is called UTC_Hospital ()

Thanks for any and all help...I am at wits end and naturally they need this function to work asap.
acoder's Avatar
acoder
Site Moderator
11,619 Posts
May 15th, 2008
10:10 AM
#2

Re: Getting DHTML to let me use a javascript function for the URL
Set the URL to index.html:
Expand|Select|Wrap|Line Numbers
  1. DQM_url12 = "/index.html";

See if you can set onclick somewhere. If so, set onclick to UTC_Hospital(). If not, you'll need to modify the generated link:
Expand|Select|Wrap|Line Numbers
  1. // access the link
  2. var link = document.getElementById("linkID");
  3. // set onclick
  4. link.onclick=UTC_Hospital;

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,816 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Javascript / DHTML / Ajax Forum Contributors