•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 397,771 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,539 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1697 | Replies: 5
![]() |
| |
•
•
Join Date: Jun 2005
Posts: 10
Reputation:
Rep Power: 4
Solved Threads: 0
I am working on this site which has a login page, it is up live and works fine from my computer but can't get it to work anywhere else.
This is the code:
<form>
<p><B><FONT SIZE="2" FACE="ARIAL">USER NAME :</B>
<input type="text" name="text2">
</p>
<p><B>PASSWORD :</B>
<input type="password" name="text1">
<input type="button" value="Login" name="Submit" onclick=javascript:validate(text2.value,"tekko",text1.value,"sydney") >
</p>
</form>
<script language = "javascript">
function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('success.html');
else
{
load('failure.html');
}
}
function load(url)
{
location.href=url;
}
</script>
Does anyone know what I'm doing wrong?
This is the code:
<form>
<p><B><FONT SIZE="2" FACE="ARIAL">USER NAME :</B>
<input type="text" name="text2">
</p>
<p><B>PASSWORD :</B>
<input type="password" name="text1">
<input type="button" value="Login" name="Submit" onclick=javascript:validate(text2.value,"tekko",text1.value,"sydney") >
</p>
</form>
<script language = "javascript">
function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('success.html');
else
{
load('failure.html');
}
}
function load(url)
{
location.href=url;
}
</script>
Does anyone know what I'm doing wrong?
•
•
Join Date: Jun 2005
Posts: 10
Reputation:
Rep Power: 4
Solved Threads: 0
•
•
•
•
Originally Posted by tgreer
You don't need the "javascript:" in the onclick attribute. Other than that, I'd need to know more about the specific problem. You might need full URLs rather than just filenames for "success.html" and "failure.html". What error are you getting?
cheers
cynch
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
I can't help but ask. cynch, you do realize that this login script has zero security value, right? The username and password are written out to the browser and viewable in the source code.
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
cynch, for what it's worth, if your server supports PHP, I submitted what I think is an elegant code solution for managing user sessions and password-protecting PHP pages. It's here on Daniweb in the Code Snippets section.
http://www.daniweb.com/code/snippet291.html
You do need to be a programmer, though, to incorporate the class. I've included a lot of comments and example usage in the code.
http://www.daniweb.com/code/snippet291.html
You do need to be a programmer, though, to incorporate the class. I've included a lot of comments and example usage in the code.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
ajax asp black friday customers developer development distance education education experiment funds gift cards holiday holiday shopping home html india intel internet investments javascript media microsoft msdn news office online online education online shopping pc portfolio practices programming publishing retail retail stocks shopping site software sql stocks strayer study survey teleworking tips tutorials vista web work xbox 360
- Login used to work (ASP.NET)
- Work offline is default (Web Browsers)
- vB Sessions/Online list (PHP)
- IE wont work :-( (Web Browsers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: setting variable using url
- Next Thread: what do you use?



Hybrid Mode