PDA

View Full Version : I need some HTMl/Javascript help


joz
04-07-2008, 09:41 PM
Im creating a website for a comp sci class, and I thought I would have a bit of fun with "42" yadda yadda

What I need is either a java or html box were the correct imput is 42 to go to a "secret page"

<form action="hidp.html"
method="get">
Answer to the universe?
<input type="password" name="password" value="" size="8" maxlength="2">
<input type="submit" value="Submit" />
</form>



<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function checkPw(form) {
pw1 = form.pw1.value;

if (pw1 != 42) {
alert ("\nYou did not enter the correct password")
return false;
}
else return true;
}
// End -->
</script>

<form onSubmit="return checkPw(this)">
<center>
<table border=0>
<tr>
<td>Password:</td><td><input type=text name=pw1 size=10></td>
</tr>
<td colspan=2 align=center><input type=submit value="Submit!"></td>
</tr>
</table>
</form>


the first one accepts any two letter combos, and the second one I cant figure out how to link to the page I want it to go to (hidp.html)


And I realy, realy suck at coding **** beyond simple things like bg color and centering...yea.

------\
in a nut shell

enter correct password "42"
goes to hidp.html

alfhenrik
04-08-2008, 01:55 AM
You could try this...

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function checkPw() {
if (document.xform.pw1.value != 42) {
alert ("You did not enter the correct password");
return false;
}
else {
return true;
}
}

function redirect() {
this.window.location = "hidp.html";
}
// End -->
</script>

<form name="xform" action="javascript:redirect();" onSubmit="return checkPw();">
<center>
<table border=0>
<tr>
<td>Password:</td><td><input type=text name=pw1 size=10></td>
</tr>
<td colspan=2 align=center><input type=submit value="Submit!""></td>
</tr>
</table>
</form>

joz
04-08-2008, 06:21 AM
yea, I got some help on another forum already. But now i have a differnt problem:

I have "click_here_to_start.html" and folder "HTML" in "HTML Assignment" folder.

HTML Assignemtn->C_h_t_s.html and HTML (folder)

in the html I have:

<title>Click the link to view HW5a Assignment.</title>
<br>
<br>
<br>
<br>
<center><form>
<input type="Button" Value="Click here to begin." ONCLICK="window.location.href='HTML\hw5a.html'">
</center>

but its not linking through.

in a nutshel: I need the button to work, and link through to the sub-directory. click button in the page outside the sub-directory - > go to hw5a.html inside "HTML" folder,

joz
04-08-2008, 10:34 PM
nvm im an idiot proven agian, I had my slash backwards...


But, does anyone know how to link to a file inside a zip?