Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    new to this (prompts)

    Im so new to this, i have a book ect, but am struggling, i need to get a prompt up when i click a button, can anyone help, basic i know but im stuck

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Location
    San Antonio, TX
    Posts
    131
    Thanks
    1
    Thanked 0 Times in 0 Posts
    what type of button, and what do you want the prompt to say, or do?

    Imperial Spider

  • #3
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well basically i want a prompt to appear when the button is pressed with text saying enter a city below or summit like that, i can do the rest i think lol, i just cannot get the damn button to open a prompt

  • #4
    Regular Coder
    Join Date
    Jan 2004
    Location
    San Antonio, TX
    Posts
    131
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up so, if I understand, you just want a js alert... try this

    Code:
    <input type="button" value="Submit" onClick="alert('You forgot to enter a City.');">
    Hope this is what you are looking for.

    Imperial Spider

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    <Script type = text/javascript>
    function getName() {
    var city = prompt ("Please enter the name of a city.....", "");
    if (city.length<4) { // ensures city name at least 4 characters length
    city = prompt ("Please try again.....", "");
    if (city.length <4) {
    getName(); // go round again until a valid response is given
    }
    }
    }
    </script>

    <Input type = "button" name= "button1" value = "Enter your city" onclick="getName()">

    Do please write English. There is no need to advertise poor literacy.
    Last edited by Philip M; 01-09-2007 at 09:59 PM.

  • #6
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the help, perfect!
    cheers dude


  •  

    Posting Permissions

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