40 users online (1 members and 39 guests)  

Thread: Javascript


  Results 1 to 8 of 8

Related

  1. how to stop javascript via another javascript    Forum: Javascript Forum
    Replies: 0
  2. Replies: 8
  3. Replies: 5
  4. Javascript / css    Forum: Javascript Forum
    Replies: 1
  5. JavaScript    Forum: Javascript Forum
    Replies: 2
  1. #1
    allstarr
    allstarr's Avatar
    Guest

    Post Javascript...

    I'm starting to get down and dirty with javascript, and I've created this script that I don't know why it's working. I made this up myself, so it's not premade, so I guess javascript is being picky or something, can anybody help?

    <script language="javascript">
    <!--
    function p***word() {
    var p***word="Enter";
    var right="http://www.spaceports.com";
    var wrong="http://www.angelfire.com";
    var x=document.Form1.Form2.value;
    if (x==p***word) {
    window.location.href=right;
    }
    else {
    location.href=wrong;
    )
    }
    -->
    </script>

    <form name="Form1">
    <input name="Form2" type="text" size="25">
    </input>
    <input name="button" type="button" value="Enter" onclick="p***word()">
    </input>
    </form>


  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Post

    I got rid of the first error by adding top to the chain. It now errors onclick. I'm just a beginner too, but I'll keep trying!

    ------------------
    QuietDean-
    Last edited by HTML; 04-18-2004 at 09:39 PM.

  3. #3
    allstarr
    allstarr's Avatar
    Guest

    Post

    After messing with it more, I think I've only got one little problem. No matter what I type in it goes to Anglefire, but when I change (x==p***word) to (x=p***word), it only goes to spaceports. So that's where I am. Thanks for helping

    <script>

    function p***word()
    {
    var p***word="Enter";
    var right="http://www.spaceports.com";
    var wrong="http://www.angelfire.com";
    var x="document.Form1.Form2.value";
    if (x==p***word) window.location.href=right
    else window.location.href=wrong
    }
    </script>


    <form name="Form1">
    <input name="Form2" type="text" size="25" />
    <input name="button" type="button" value="Enter" onclick="p***word()" />
    </form>
    Last edited by HTML; 04-18-2004 at 09:40 PM.

  4. #4
    allstarr
    allstarr's Avatar
    Guest

    Post

    I got it! Here's the code:<script>

    function p***word()
    {
    var p***word="champion";
    var right="http://www.spaceports.com";
    var wrong="http://www.angelfire.com";
    var x=document.Form1.Form2.value;
    if (x==p***word) window.location.href=right
    else window.location.href=wrong
    }
    </script>


    <form name="Form1">
    <input name="Form2" type="text" size="25" />
    <input name="button" type="button" value="Enter P***word" onclick="p***word()" />
    </form>

    I just needed to get rid of the quotes on the x="document.form1.form2.value";!


  5. #5
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Post

    doh!

    ------------------
    QuietDean-
    Last edited by HTML; 04-18-2004 at 09:40 PM.

  6. #6
    allstarr
    allstarr's Avatar
    Guest

    Post

    javascript can really screw you up even if you have one dumb thing like that not done
    Last edited by HTML; 04-18-2004 at 09:41 PM.

  7. #7
    AsifTheManRa's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2004
    Posts
    6

    Email With Javascript

    Hi
    I'm quite new to javascript. I am currently working on an online job application system where I require users to enter their name, address, resume, etc. in spaces provided, and then, upon clicking the "Submit" button, I require all this info to be emailed to the user automatically, as well as go on to the next page. Can anyone help please?


    Thanks

  8. #8
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    Please start a new thread this one is 3 years old.



Tags for this Thread