Results 1 to 4 of 4

Thread: Basic Help

  1. #1
    robjames is offline Member
    Join Date
    Feb 2009
    Posts
    1
    Rep Power
    0

    Default 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>

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default Java...

    robjames... this is a Java development forum... not a Javascript forum. The two are different. For example, in java, the follwing is wrong:
    Java 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
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  3. #3
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    Sometimes people really confuse these two things as Java or JS ((( That's a pity (

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

Similar Threads

  1. Need some really basic help
    By Mayur in forum New To Java
    Replies: 6
    Last Post: 01-24-2009, 06:00 AM
  2. inheritance basic.
    By newmember in forum New To Java
    Replies: 1
    Last Post: 08-02-2008, 09:35 PM
  3. basic java help
    By adred in forum New To Java
    Replies: 0
    Last Post: 03-08-2008, 12:36 PM
  4. Basic Program Please Help!!
    By VinceGuad in forum New To Java
    Replies: 3
    Last Post: 02-01-2008, 03:35 PM
  5. help with basic example
    By fred in forum New To Java
    Replies: 1
    Last Post: 07-20-2007, 05:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •