Coding with Firefox: Alternative for "onclick"?

madmatt

Bow Down to the King
Political User
Joined
Apr 5, 2002
Messages
13,312
I'll admit, I am the typical Microsoft guy who doesn't bother with Firefox. I received an email from a client today with a problem that their online job application is not coming through. I decided to install Firefox on a virtual OS and see if it had something to do with the way Firefox handles the code.

I didn't find a problem with the initial application but with the next step in the process.

I am using a text link with the "onclick" property.

PHP:
<a href="#" class="menulink" onClick="submit();">Click here to take the affirmative action online survey.</a>
I know there is a problem because Firefox does not support "onclick". Weird.

I got tired of researching it so decided to ask. Thank you.
 

albybum

Penguin Rancher
Joined
Feb 9, 2002
Messages
280
no caps, try onclick rather than onClick

Also, you may need to be specific about the form being submitted.

Alternatively, you can embed javascript in the href attribute.

Like,
Code:
<a href="javascript:document.getElementById('frmGoogleSearch').submit();">Google Search!</a>
 
Last edited:

Geffy

OSNN Veteran Addict
Joined
Mar 18, 2002
Messages
7,805
as albybum said its most likely to be the attribute case. if you want to try it in firefox with a javascript console then download firebug as well for firefox
 

madmatt

Bow Down to the King
Political User
Joined
Apr 5, 2002
Messages
13,312
I'm not making any progress.

PHP:
<form method="POST" name="aasurvey" action="index.php?show=careers&sub=aasurvey">

  <input type="hidden" name="position" value="<?php print $_POST['position']; ?>">
  <input type="hidden" name="date" value="<?php print date('m/d/Y'); ?>">
  <input type="hidden" name="howDid" value="<?php print $_POST['howDid']; ?>">
  <input type="hidden" name="firstName" value="<?php print $_POST['firstName']; ?>">
  <input type="hidden" name="middleName" value="<?php print $_POST['middleName']; ?>">
  <input type="hidden" name="lastName" value="<?php print $_POST['lastName']; ?>">
  <input type="hidden" name="address" value="<?php print $_POST['address']; ?>">
  <input type="hidden" name="address2" value="<?php print $_POST['address2']; ?>">
  <input type="hidden" name="city" value="<?php print $_POST['city']; ?>">
  <input type="hidden" name="state" value="<?php print $_POST['state']; ?>">
  <input type="hidden" name="zipCode" value="<?php print $_POST['zipCode']; ?>">
  <input type="hidden" name="country" value="<?php print $_POST['country']; ?>">
  <input type="hidden" name="phoneNumber1" value="<?php print $_POST['phoneNumber1']; ?>">
  <input type="hidden" name="phoneNumber2" value="<?php print $_POST['phoneNumber2']; ?>">
  <input type="hidden" name="ssn" value="<?php print $_POST['ssn']; ?>">
  <input type="hidden" name="emailAddress1" value="<?php print $_POST['emailAddress1']; ?>">
  <input type="hidden" name="emailAddress2" value="<?php print $_POST['emailAddress2']; ?>">

  In an effort to comply with requirements regarding government recordkeeping, reporting, and other legal obligations which may apply, we invite you to complete the <a href="javascript:void(0);" class="menulink" onClick="submit();">affirmative action online survey</a>.  Providing this information is <b>STICTLY VOLUNTARY</b>.  Failure to provide it will not subject you to any adverse personnel decision or action.<br>

  &nbsp;<br>

  <a href="javascript:document.getElementById('aasurvey').submit();" class="menulink">Click here to take the affirmative action online survey.</a>

</form>
See final a href.

First, I changed "onClick" to "onclick". No difference.

Next, I changed it to the statement that alby suggested. No difference.

Next, I installed Firebug and it's not telling me there is anything wrong.

Furthmore, the statement alby gave me works perfectly with IE6 and IE7.
 
Last edited:

Khayman

I'm sorry Hal...
Political User
Joined
Jan 6, 2002
Messages
5,518
you are using "getElementById" but have not set the id of the form.

Add id="aasurvey" to your form tag
 

madmatt

Bow Down to the King
Political User
Joined
Apr 5, 2002
Messages
13,312
Oh gee now I feel dumb. Thanks everyone.
 

albybum

Penguin Rancher
Joined
Feb 9, 2002
Messages
280
This also works.

Code:
<a href="#" class="menulink" onclick="document.aasurvey.submit();">Click here to take the affirmative action online survey.</a>
 

X-Istence

*
Political User
Joined
Dec 5, 2001
Messages
6,498
This also works.

Code:
<a href="#" class="menulink" onclick="document.aasurvey.submit();">Click here to take the affirmative action online survey.</a>
It won't properly on certain browsers. Since some browsers won't populate the document namespace with all the "id" attributes. Konqueror being a prime example, neither does Safari.
 

Members online

No members online now.

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Hey ep!

All good with me, applying for microsoft mvp right now, should have done this a while ago.

Notifications don't work, I only found your response by comming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier, mine is perriscalderon at gmail
Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...

Forum statistics

Threads
61,974
Messages
673,294
Members
89,042
Latest member
Pancake