Here is my code! My problem is when I do this from my computer it works great, but as soon as I upload it to the server it no longer works! The page shows up fine but my login box does not pop up!
%26lt;html%26gt;
%26lt;HEAD%26gt;
%26lt;meta http-equiv=';Content-Type'; content=';text/html; charset=utf-8';%26gt;
%26lt;style type=';text/css';%26gt;
%26lt;!--
.style13 {
color: #CC66CC;
font-weight: bold;
}
.style16 {font-size: 18px}
.style22 {font-size: 16px}
--%26gt;
%26lt;/style%26gt;%26lt;BODY%26gt;
%26lt;center%26gt;
%26lt;p%26gt;%26lt;img src=';ORIGINAL LOGO.JPG'; alt=';Crystal Boutique'; width=';300'; height=';100'; longdesc=';http://www.x.com';%26gt;%26lt;/p%26gt;
%26lt;p class=';style10';%26gt;%26lt;font size=';5'; face=';Perpetua';%26gt; %26lt;span class=';style13';%26gt;Please Sign In!%26lt;/span%26gt;%26lt;/font%26gt;%26lt;/p%26gt;
%26lt;p class=';style10';%26gt;聽%26lt;/p%26gt;
%26lt;/center%26gt;
%26lt;SCRIPT LANGUAGE=';JavaScript';%26gt;
function LogIn(){
loggedin=false;
username=';';;
password=';';;
username=prompt(';Username:';,';';);
username=username.toLowerCase();
password=prompt(';Password:';,';';);
password=password.toLowerCase();
--%26gt;Enter Username/Password Below %26lt;--
if (username==';ashley00'; %26amp;%26amp; password==';2838';) {
loggedin=true;
window.location=';http://216.105.55.115鈥?br>
}
if (username==';evi01'; %26amp;%26amp; password==';2594';) {
loggedin=true;
window.location=';http://216.105.55.115鈥?br>
}
if (username==';kristen02'; %26amp;%26amp; password==';6510';) {
loggedin=true;
window.location=';http://216.105.55.115鈥?br>
--%26gt;Enter Username/Password Above %26lt;--
if (loggedin==false) {
alert(';Sorry! Invalid Login Information!';);
}
}
%26lt;/SCRIPT%26gt;
%26lt;center%26gt;
%26lt;form%26gt;
%26lt;input type=button value=';Sign In!'; onClick=';LogIn()';%26gt;
%26lt;/form%26gt;
%26lt;/center%26gt;
%26lt;p%26gt;聽%26lt;/p%26gt;
%26lt;p align=';center';%26gt;聽%26lt;/p%26gt;
%26lt;p align=';center'; class=';style16';%26gt;%26lt;span class=';style9 style22';%26gt;%26lt;font face=';Perpetua';%26gt;If you are having problems logging in click %26lt;a href=';mailto:x@comcast.net';%26gt;here%26lt;/a%26gt; to report it.%26lt;/font%26gt; %26lt;font face=';Perpetua';%26gt;%26lt;br%26gt;
Click %26lt;a href=';http://www.x.com';%26gt;here%26lt;/a%26gt; to return to main page.%26lt;/font%26gt;%26lt;font face=';Perpetua';%26gt;%26lt;/font%26gt;%26lt;/span%26gt; %26lt;/p%26gt;
%26lt;/center%26gt;
%26lt;/body%26gt;
%26lt;/html%26gt;Please help! HTML / JavaScript password coding problem!?
You had a number of syntax errors. I corrected those. There are some style and convention issues which I did not correct, but those will not prevent the proper functioning of the code. I tagged my changes with the HTML comment blocks that include the string ';ruie'; to make it easier to identify them. I tested only in Firefox 2 and IE7.
%26lt;html%26gt;
%26lt;HEAD%26gt;
%26lt;meta http-equiv=';Content-Type'; content=';text/html; charset=utf-8';%26gt;
%26lt;style type=';text/css';%26gt;
%26lt;!--
.style13 {
color: #CC66CC;
font-weight: bold;
}
.style16 {font-size: 18px}
.style22 {font-size: 16px}
--%26gt;
%26lt;/style%26gt;
%26lt;!-- ruie - move script block to head --%26gt;
%26lt;SCRIPT LANGUAGE=';JavaScript';%26gt;
function LogIn(){
loggedin=false;
username=';';;
password=';';;
username=prompt(';Username:';,';';);
username=username.toLowerCase();
password=prompt(';Password:';,';';);
password=password.toLowerCase();
//--%26gt;Enter Username/Password Below %26lt;-- %26lt;!-- ruie - js comment --%26gt;
if (username==';ashley00'; %26amp;%26amp; password==';2838';) {
loggedin=true;
window.location=';http://216.105.55.鈥?ruie - ??? --%26gt;
}
if (username==';evi01'; %26amp;%26amp; password==';2594';) {
loggedin=true;
window.location=';http://216.105.55.鈥?ruie - ??? --%26gt;
}
if (username==';kristen02'; %26amp;%26amp; password==';6510';) {
loggedin=true;
window.location=';http://216.105.55.鈥?ruie - ??? --%26gt;
//--%26gt;Enter Username/Password Above %26lt;-- %26lt;!-- ruie - js comment --%26gt;
}%26lt;!-- ruie - close if block --%26gt;
if (!loggedin) { %26lt;!-- ruie - simplify syntax --%26gt;
alert(';Sorry! Invalid Login Information!';);
}
}
%26lt;/SCRIPT%26gt;
%26lt;/head%26gt; %26lt;!-- ruie - close head --%26gt;
%26lt;BODY%26gt;
%26lt;center%26gt;
%26lt;p%26gt;%26lt;img src=';ORIGINAL LOGO.JPG'; alt=';Crystal Boutique'; width=';300'; height=';100'; longdesc=';http://www.x.com';%26gt;%26lt;/p%26gt;
%26lt;p class=';style10';%26gt;%26lt;font size=';5'; face=';Perpetua';%26gt; %26lt;span class=';style13';%26gt;Please Sign In!%26lt;/span%26gt;%26lt;/font%26gt;%26lt;/p%26gt;
%26lt;p class=';style10';%26gt; %26lt;/p%26gt;
%26lt;form%26gt;
%26lt;input type=button value=';Sign In!'; onClick=';LogIn()';%26gt;
%26lt;/form%26gt;
%26lt;/center%26gt;
%26lt;p%26gt; %26lt;/p%26gt;
%26lt;p align=';center';%26gt; %26lt;/p%26gt;
%26lt;p align=';center'; class=';style16';%26gt;%26lt;span class=';style9 style22';%26gt;%26lt;font face=';Perpetua';%26gt;If you are having problems logging in click %26lt;a href=';mailto:x@comcast.net';%26gt;here%26lt;/a%26gt; to report it.%26lt;/font%26gt; %26lt;font face=';Perpetua';%26gt;%26lt;br%26gt;
Click %26lt;a href=';http://www.x.com';%26gt;here%26lt;/a%26gt; to return to main page.%26lt;/font%26gt;%26lt;font face=';Perpetua';%26gt;%26lt;/font%26gt;%26lt;/span%26gt; %26lt;/p%26gt;
%26lt;/center%26gt;
%26lt;/body%26gt;
%26lt;/html%26gt;Please help! HTML / JavaScript password coding problem!?
Javascript is a really bad solution for a password. Anyone can look at your source code and even modify your script however they like.
If you want a password you need to do something on the server side, not the client side.