Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit function assinged to a link works in IE but not Netscape or Fir

Status
Not open for further replies.

tsynnott

Technical User
Joined
Nov 11, 2003
Messages
2
Location
US
I am able to login to a database with a generic account (an account without a password that calls up a search form) by clicking on a link for which the href attribute calls a jscript function. What I show below works in IE but not in Netscape or Firefox.
Code:
<div>
<form target="info" method="POST" action="[URL unfurl="true"]http://localhost/scripts/falcon/dmslogin2.exe?login"[/URL] name="SubmitLogin_d1asbuilt">
<input type="hidden" name="startForm">
<input type="hidden" name="UserName" value="d1asbuilt">
<input type="hidden" name="Password" value="">
<input type="hidden" name="cmd" value="login">
<a href="javascript:SubmitLogin_d1asbuilt.submit()">As Builts</a>
</form>
</div>
I am pretty new to this stuff and would like to avoid coding to account for cross browser compatibility if possible (still learning). Can someone advise me on how to get the <A> element approach shown above to work in all browsers?
 
Add [red]id='SubmitLogin_dqasbuilt'[/red] to the form tag.

...or...

Change your anchor tag to:

javasceript:document.forms[0].submit();

IE is too forgiving here.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Change this:

Code:
<a href="javascript:SubmitLogin_d1asbuilt.submit()">As Builts</a>

to this:

Code:
<a href="javascript:document.forms['SubmitLogin_d1asbuilt'].submit();">As Builts</a>

Although why you don't just use a regular submit button, so that it works for those without JS, I cannot fathom.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan and Dave,
Between both your suggestions the function is working in all three of the required browsers.

Dan, FYI, the reason for the js is that I have about 30 blind accounts, each accessing a search form with different predefined criteria. To facilitate ease of use, the blind accounts have been incorporated into an exandable/collapsible menu system in a 'navigation' frame that allows for the display the appropriate search form in a second frame.

You guys really were of great help.

Thanks.
Thomas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top