I am making a password script, i have most of it done, ill show you, but i hit a brick wall.... lol, I have it so when you log in it takes you to your main page, that works, but when you enter the wrong info, it's supposed to say "Invalid Username or Password" below the login boxes. (Using the document.write command), but to do this, i need to refrence the main script to get the yes or no if they logged in right.... i need help.... im using inernet explorer v6.0, heres my script: This is my external .js file (name is pass.js): - <!-- Begin
-
function Login() {
-
var error="No Errors";
-
var done=0;
-
var username=document.login.username.value;
-
username=username.toLowerCase();
-
var password=document.login.password.value;
-
password=password.toLowerCase();
-
//User info//
-
if (username=="eragon" && password=="password") { window.location="pages/eragon.htm"; done=1; }
-
//End User Info//
-
if (done==0) { error="Incorrect Username or Password"; }
-
}
-
// End -->
Ok, that was my external .js file, now heres my web page sorce code: - <html>
-
<head>
-
<title>login</title>
-
<script language="javascript" src="pass.js">
-
</head>
-
<body>
-
<form name="login">
-
<input type="text" name="username">
-
<input type="password" name="password">
-
<input type="button" value="login" onClick="login()">
-
</form>
-
<!-- This is the part i need help with: -->
-
<script language="Javascript">{ document.write (error); }</script>
-
</body>
-
</html>
So, you saw my scripts, i would appreciate it if you test them, and tell me anything that is wrong.... thanks much, nice people...
Yours thankfully,
Eragon Eisert
5 1698
I am making a password script, i have most of it done, ill show you, but i hit a brick wall.... lol, I have it so when you log in it takes you to your main page, that works, but when you enter the wrong info, it's supposed to say "Invalid Username or Password" below the login boxes. (Using the document.write command), but to do this, i need to refrence the main script to get the yes or no if they logged in right.... i need help.... im using inernet explorer v6.0, heres my script: This is my external .js file (name is pass.js): - <!-- Begin
-
function Login() {
-
var error="No Errors";
-
var done=0;
-
var username=document.login.username.value;
-
username=username.toLowerCase();
-
var password=document.login.password.value;
-
password=password.toLowerCase();
-
//User info//
-
if (username=="eragon" && password=="password") { window.location="pages/eragon.htm"; done=1; }
-
//End User Info//
-
if (done==0) { error="Incorrect Username or Password"; }
-
}
-
// End -->
Ok, that was my external .js file, now heres my web page sorce code: - <html>
-
<head>
-
<title>login</title>
-
<script language="javascript" src="pass.js">
-
</head>
-
<body>
-
<form name="login">
-
<input type="text" name="username">
-
<input type="password" name="password">
-
<input type="button" value="login" onClick="login()">
-
</form>
-
<!-- This is the part i need help with: -->
-
<script language="Javascript">{ document.write (error); }</script>
-
</body>
-
</html>
So, you saw my scripts, i would appreciate it if you test them, and tell me anything that is wrong.... thanks much, nice people...
Yours thankfully,
Eragon Eisert
Java != Javascript.
Moved to javascript forum.
You can't write to the page using document.write() after the page has loaded.
Have a div or a span on the page:
then in your login function at the end: - document.getElementById("errors").innerHTML=error;
Also, the case must be the same for the function names - you can't use login and Login interchangeably.
it works great! my internet was down so i couldnt post right away, but i tried the script and it works great... just one more question... how do i get the error to only appear if the information is unvalid. I need this because the error message appears every time while the next page is loading. Thank you all for your help!
When you run your login function, if there are no errors, set the errors variable to an empty string. Then set the div to remove the error message.
i got it all working, thanks... i have another topic i need help with, look for my other thread called "Simple edit... or is it? Help Me!!!" and look at the description...
Sign in to post your reply or Sign up for a free account.
Similar topics
by: nightsaber |
last post by:
<script language="JavaScript">
<!-- hide me
var the_number = prompt("how many words (3-5 is good)?", "4");
var the_string = "";
var a_word;
for (loop = 0; loop < the_number; loop++)
{...
|
by: Jack |
last post by:
I have a asp form where among others there are few text boxes and one check
box. The checkbox is
to indicate whether the entry is final. The checkbox is attahced to a field
in table of type...
|
by: Tee |
last post by:
Hi,
I need some help here for DSN connection string.
I know it's not recommended to use DSN, even I dont like it as well ...
but for now, my situation is I am using a shared hosting. I do not...
|
by: JustSomeGuy |
last post by:
According to the docs...
http://www.cppreference.com/cpplist/sort.html
There is a parameter to the std::list.sort method.
I don't understand this methods use...
I want to sort the list which...
|
by: gavino |
last post by:
This seems easy but I have been asking tcl and python IRC chat all day
and no one gave an answer.
I have 100 servers which need a new backup server added to a text file,
and then the backup agent...
|
by: nephish |
last post by:
Hello there,
i am getting to need to make my web stuff more OO.
i have a project at work that we are porting to the internet, and i
started learning php to do so.
the project is now mamoth is...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need ...
|
by: Jorhajnes |
last post by:
Hi there.
Im very new to making games in flash, although I have used flash for quite some time now in web-based situations so I know my way around.
Anyways, I thought it would be fun to try...
|
by: Chuck Anderson |
last post by:
I run Apache 2.0.55, and Php (both 4.4.1 and 5.2.5) on my home PC
(Windows XP). One of the scripts that I run daily needs to access a
secure URL (https://..............). When I am running Php4,...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |