Finally! I got it to work! This is the code that got it to work:
<html><head><title>Test log in screen</title>
<style type="text/css">
#login {
float: none;
text-align: left;
width: 410px;
margin: 0px auto;
margin-top: 134px;
background: #1AD00B;
border: 4px solid #12B20A;
font-family: arial;
color: #D0170B;
padding: 0 0 15px 25px;
opacity: .85;
filter: alpha(opacity=85);
}
#title {
font-size: 24px;
font-weight: bold;
display: block;
width: 385px;
border-bottom: 2px solid #0506FF;
margin-bottom: 30px;
}
#submit {
background: #04E7CB;
color: #04E7CB;
font-size: 18px;
font-weight: bold;
padding: 4px;
margin-left: 5px;
}
#p {
border: 5px solid #FFF80A;
font-size: 18px;
padding: 5px;
width: 305px;
}
</style>
<!--[if IE]>
<style type="text/css">
#login {
padding: 25px 25px 15px 25px;
}
#p {
width: 270px;
height: 35px;
}
#submit {
padding: 0px;
margin-left: 5px;
height: 38px;
position: relative;
top: 2px;
color: #000000;
}
</style>
<! [endif]-->
</head>
<body style="background: #FFCA05; text-align: center; margin: 0; padding: 0;">
<div id="login">
<form>
<p id="title">Login here:</p>
<form>
<p>User Name :
<input type="text" name="text2">
</p>
<p>Password :
<input type="password" name="text1">
</p>
<p><input type="button" value="Submit" name="Submit"
onclick=javascript:validate(text2.value,"Happy",text1.value,"Sad") >
</p>
</form>
<script language = "javascript">
function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('What to load when it works.htm');
else
{
load('what to do when it's a failure.htm');
}
}
function load(url)
{
location.href=url;
}
</script>Thanks to everybody who tried to help. I can't believe I got it myself. I would like to give special thanks to MoreGamesNow (you know - the rubix cude person). He/She knows a lot about the subject and was always checking back in to see if there were more answers to be answered (if you know what I mean). The best way to show my happiness -->
Sadly, the images just can't explain it. I am just so happy... Thanks for everything!
Last edited by PullJosh (2012-01-27 07:45:08)

Offline
try
<SCRIPT TYPE="test/javascript">
instead of
<SCRIPT LANGUAGE="JavaScript">
Offline
nathanprocks wrote:
try
Code:
<SCRIPT TYPE="test/javascript">instead of
Code:
<SCRIPT LANGUAGE="JavaScript">
no.
also,
str.link
maybe try
window.location
Offline
try
<script type="text/javascript">
plus ur tags shouldnt be in caps.
Offline
if(TestVar == "hello")
First thing I saw was: add quotation marks.
And if you want it to automatically go to a different site, just use
window.location = "http://what_ever_the_url_is.com"
Edit: Sorry for that last bit, it is a bit redundant as bbbeb also posted it.
I also suggest using "text/javascript" whenever possible, as it is more up-to-date I believe. May I ask why you have a method="GET" but not an action? Unless you're using php - and from what you've shown us, you're not -, you don't need to have a "method". Just <form name="myform">.
<HTML>
<HEAD>
<TITLE>Test Input</TITLE>
<SCRIPT LANGUAGE="text/javascript">
function testResults ()
{
var TestVar = document.myform.inputbox.value;
if(TestVar == "hello")
{
window.location = "http://www.aWebsite.com";
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="myform">Enter something in the box: <BR>
<INPUT TYPE="text" NAME="inputbox">
<INPUT TYPE="button" Value="Click" onClick="testResults()">
</FORM>
</BODY>
</HTML>Last edited by MoreGamesNow (2012-01-19 21:47:43)
Offline
<HTML>
<HEAD>
<TITLE>Test Input</TITLE>
<script type="text/javascript">
function testResults (form) {
var TestVar = form.inputbox.value;
if(TestVar == "hello")
{
window.location.href = "http://google.com";
};
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="myform" ACTION="">Enter something in the box: <BR>
<INPUT TYPE="text" NAME="inputbox" VALUE=""><P>
<INPUT TYPE="button" NAME="button" Value="Click" onClick="testResults(this.form)">
</FORM>
</BODY>
</HTML>


Offline
you don't need ".href".
Offline
Use double equals sign to check equality, and a single to set a variable.
Offline
scimonster wrote:
Use double equals sign to check equality, and a single to set a variable.
![]()
Thanks. I knew that, but there are such things as typos... I'm not saying that your comment wasn't useful. It definitely was.

Offline
You don't want document.getElementById('p');, you want document.loginForm.passwerd.value. Having said that, you may be able to get away with document.getElementById('p').value
Edit: I said "may be able to" because it has been a while since I have used anything other than document.formname.inputname.value
Last edited by MoreGamesNow (2012-01-22 20:37:05)
Offline