By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,761 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,761 IT Pros & Developers. It's quick & easy.

"Invalid return" error

P: n/a
Hi,
I get the "Invalid return" error (in Javascript console) when I run
this piece of code:

<a href="javascript:if (document.dc_form.tn.value == ''' &&
document.dc_form.cid.value == '') { alert('You have not made a
selection. Please select one of the fields first.');return false; }
document.dc_form.submit();">Go!</a>

If I remove the "return false;", it displayes the alert and continues
to what it is NOT supposed to do.

TIA.

Nov 7 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Lee
Xerxes said:
>
Hi,
I get the "Invalid return" error (in Javascript console) when I run
this piece of code:

<a href="javascript:if (document.dc_form.tn.value == ''' &&
document.dc_form.cid.value == '') { alert('You have not made a
selection. Please select one of the fields first.');return false; }
document.dc_form.submit();">Go!</a>

If I remove the "return false;", it displayes the alert and continues
to what it is NOT supposed to do.
That's a really bad idea.
The javascript: pseudo-protocol was designed to load the value of the Javascript
expression as the new contents of the page. Returning false doesn't make any
sense. Neither does submitting the form from within the expression. If you
don't want a link, don't use a link. Use a button.

http://www.jibbering.com/faq/#FAQ4_24
--

Nov 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.