Warning: Function get_magic_quotes_gpc() is deprecated in /var/www/trogworld.com/public_html/forums/includes/class_core.php on line 1960
JavaScript help please. [Archive] - TrogWorld

PDA

View Full Version : JavaScript help please.



Bushwacker
11-08-2005, 11:46 PM
Ok heres the deal.

I really don’t know much about javascript and I have to do a simple page for school. So I’m going to try and cheat a bit and ask someone here show me how to do my little project. Anybody game?

This is what I'm supposed to do...
Create a simple web page that contains each of the following items:
All of the tags necessary to create a basic web page (I can do this part)
Your name in the TITLE of the page and in the BODY of the page (this part to)
A JavaScript that password protects the page. The script should
Prompt the user for a password
Compare the text entered by the user to the password using an if-else statement
Return a failure message if the password does not match Display text that says "Congratulations!" if the password does match.

Almuric
11-09-2005, 07:34 AM
I dont know anything about Javascript, but here's your code:


<HEAD>
<script language="JavaScript">
<!--hide

var password;

var pass1="cool";

password=prompt('Please enter your password to view this page!',' ');

if (password==pass1)
Â*alert('Password Correct! Click OK to enter!');
else
Â* {
Â* Â*alert('Password Incorrect, you may not enter.');
Â* Â*}

//-->
</SCRIPT>
</HEAD>

Bushwacker
11-09-2005, 12:32 PM
Just so "EVERYBODY KNOWS" trog Rocks. :tup: :tup: