-
Basic Help
Hi Guys,
I'm hoping this is a basic thing for you guys but im very new to Java.
I got the below script given to me and although it works locally, i cant get it to work when uploaded.
I'm assuming that its because all the other links on my site work in relation to each other where as this seems to try and load success.html and failure.html differently.
Would really appreciate any help you can offer. The Script is below.
Many Thanks
Rob
<form>
<p align="center"><span class="style3">ENTER USER NAME :
</span>
<input type="text" name="text2">
</p>
<p align="center"> <span class="style3">ENTER PASSWORD :</span>
<input type="password" name="text1">
<input type="button" value="Check In" name="Submit" onclick=javascript:validate(text2.value,"wessex",t ext1.value,"hibernia") >
</p>
</form>
<script language = "javascript">
function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load(a href="success.html");
else
{
load(a href="failure.html");
}
function load(url)
{
location.href=url;
}
</script>
-
Java...
robjames... this is a Java development forum... not a Javascript forum. The two are different. For example, in java, the follwing is wrong:
Code:
if (text1==text2 && text3==text4)
In Java you don't compare strings with "=="... you use the string method "equals()". I don't know what is used for comparing strings in Javascript.
Also check the paring of curly brackets "{}"... I count 3 opening brackets and only two closing brackets.
Luck,
CJSL
-
Sometimes people really confuse these two things as Java or JS ((( That's a pity (
-
robjames, as CJSLMAN explain in his last post this, is a Java forum. Not a JavaScritp forum. It's better to ask your question on relevant JS forum. I've close this thread. If you have any further questions on this thread contact me through PMs.