Putting more than one command per line

A

art

Hi,

Sorry if this is a double post. I posted this about 1 hour ago, and
it never appeared.

I have some javascript commands I want executed when a user clicks on
an href link. My code is below. The code works fine with the first
command, but when I add the second and third commands, nothing
happens.

However, if I remove the first command, everything works fine. But I
need all three statements. Can anyone see the error in my ways?

Thanks!

<a href=\"javascript:emailvalidation('$email','The E-mail address is
not valid');document.OptOut.action = 'activate.php?type=2&db=$db&ref=
$ref&acronym=$acronym';document.OptOut.submit();\">Click Here</a>
 
T

Tim Slattery

Hi,

Sorry if this is a double post. I posted this about 1 hour ago, and
it never appeared.

Probably because you're using GoogleGroups. That system doesn't always
work as you would like it to. Try a real newsreader, like Thunderbird,
Agent or even OE.
I have some javascript commands I want executed when a user clicks on
an href link. My code is below. The code works fine with the first
command, but when I add the second and third commands, nothing
happens.

If you're using Firefox, check the error console, there may helpful
error messages there. In IE, Tools|Internet Options, Advanced tab,
under "Browsing", remove the check from "Disable script debugging",
that will get you some error messages, but not as useful as Firefox's
(IMHO)
However, if I remove the first command, everything works fine. But I
need all three statements. Can anyone see the error in my ways?
<a href=\"javascript:emailvalidation('$email','The E-mail address is
not valid');document.OptOut.action = 'activate.php?type=2&db=$db&ref=
$ref&acronym=$acronym';document.OptOut.submit();\">Click Here</a>

Personally, I'd put the statements into a Javascript function and call
the function. And I'd do it in the onclick handler here, not try to
use the "javascript:" pseudo protocol as an href. And what's with the
backslash before the double quote marks?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top