Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl/CGI/Javascript Problem

by pfaut (Priest)
on Mar 04, 2003 at 16:42 UTC ( [id://240418]=note: print w/replies, xml ) Need Help??


in reply to Perl/CGI/Javascript Problem

An anchor (A) tag needs a HREF attribute to be considered a link. If you want to execute javascript code on a click, don't use an anchor tag. Use a SPAN tag with style settings to make it stand out as a link. The anchor tag can take a TARGET attribute that will open a new window if the named target window doesn't already exist.

Remember that anchor tags can also create named anchors within pages with the NAME attribute. These anchors don't get any special visual effects and don't react to mouse clicks.

--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Replies are listed 'Best First'.
Re: Re: Perl/CGI/Javascript Problem
by b310 (Scribe) on Mar 04, 2003 at 20:03 UTC
    Hi pfaut,

    I tried to incorporate your suggestion by using the SPAN tag. I had no luck. I pasted the modified code with the new tag. Can you take a look and see where I went wrong?

    Thanks.

    $page .= p({ -style => "font-family: verdana; font-size: 10pt;" }, "Sh +ipping and tax may be added to your order.\n" . "To estimate shipping and tax, please see the " . span({-style => "background-color:gray;" -onClick + => "launchwin"}, "Shipping and Tax") . " page.\n");
      try this
      span({-style => "background-color:gray;", # added comma -onClick => "launchwin()"}, # added ()
      poj
        Hi poj,

        Once again, I owe you a debt of thanks. Your suggestion worked. One of these days, I'm going to remember those commas.

        Thanks!
Re: Re: Perl/CGI/Javascript Problem
by iguanodon (Priest) on Mar 05, 2003 at 11:33 UTC
    You can use an A tag, as:
    <a href='javascript:void(0);' onClick='do_something();'>Click here</a>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://240418]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found