Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 26th, 2003, 11:05 AM
Authorized User
 
Join Date: Nov 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default code works in IE but not netscape

Hi

I have a login script that works fine in IE but nothing happens in netscape.
Code:
//This is in the head of the page
function Login(form) {
var form = document.forms[0];
var username = form.username.value;
var password = form.password.value;
var server = form.server.value;
if (username && password && server) {
var htsite = "http://" + username + ":" + password + "@" + server;
window.location = htsite;
function login() {
var username = frmLogin.username.value;
var password = frmLogin.password.value;
var server = "217.34.217.125";
var site = "http://" + username + ":" + password + "@" + server;
child = window.open(site,'child','');
test();
}
function test() {
window.setTimeout('child.location.href="http://217.34.217.125"', 3000);
}
}
else {
alert("Please enter your username and password.");
   }
}


//this is in the body of the page
<form name=login>
<input type="hidden" name="server" value="217.34.217.122/Prod
Cat/default.asp?Region=Compressor">
<B>Username:</B>
<input type=text name=username size=18>
<B>Password:</B>
<input type=password name=password size=18>
<a href="javascript:Login(this.form)">  
<img src="/local/It/uniq0371d.nsf/GO_44.jpg?OpenImageResource"  border = "0">
</a></form></form><form onSubmit = "Javascript:doSearch(window);return(false)"><input name="search" size = 18><input type="image" onClick="doSearch(window); return false;" src="/local/it/uniq0371d.nsf/Search_29.jpg?OpenImageResource" border =0></form>
could anyone advise as to how I can adapt the code to allow it to function in both browsers.

Thanks in advance for any help given

Toka1

 
Old November 26th, 2003, 12:11 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well the nested functions look a bit odd, perhaps NN doesn't like them. It's all very complicated, why have two submits? I've also found that naming things password that are of type password can cause odd things to happen. Is all you want to do collect username and password to get to a secure site?


--

Joe
 
Old November 27th, 2003, 05:35 AM
Authorized User
 
Join Date: Nov 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi Joe

Yes all I want to do is collect user name and password which goes to server for authentication.

Thanks

Toka






Similar Threads
Thread Thread Starter Forum Replies Last Post
CRD vba code no longer works MWA_Work Crystal Reports 0 March 7th, 2008 09:46 AM
Code that works !! for chapter 3 dawsonje44 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 March 2nd, 2007 04:33 PM
PHP code - works in Firefox, fails in IE gingerbraid Beginning PHP 13 October 6th, 2005 06:33 PM
Login.aspx works in netscape, but not IE cohansh1 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 February 23rd, 2005 09:05 AM
SCRIPT WORKS WITH IE BUT NOT NETSCAPE!!! elisabeth Javascript How-To 5 October 6th, 2004 03:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.