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 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2006
    Location
    Bahrain
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    When I have typed less than minimum char's in a prompt, it alerts

    Hi!
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I need a HELP with my prompt! In a prompt, when I pressed enter, and the prompt field's character has less than minimum character(s), it alerts "type at least 6 characters please"
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I forgot, the code
    PHP Code:
    <script type="text/javascript" language="javascript">
    alert("Welcome to template maker, a template made just by PROMPTS! Note there are ")
    var 
    a=prompt("For the first prompt, type the BACKGROUND-COLOR of your site","")
    var 
    b=prompt("Next, type the FONT-FAMILY of your site","");
    var 
    c=prompt("Type the TEXT-COLOR of your site","");
    var 
    d=prompt("Type the FONT-SIZE of your site","");
    var 
    e=prompt("Type the COLOR of your LINKS","");
    var 
    f=prmopt("When you mouse over a link, type the COLOR again","");
    alert("Header time!")
    var 
    g=prompt("Type the FONT-COLOR of your site","");
    </script> 
    Last edited by codingmasta; 01-13-2007 at 02:00 PM.
    ALWAYS remember to validate your code

  • #2
    New Coder
    Join Date
    Oct 2006
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    /*
    Replace "prompt" with the prompt's var (a-g).
    According to the w3c, you should have the script type "lang/text", rather "text\lang".
    */
    if (isNaN(prompt)) { // If is not a number. Not a must.
        
    if (prompt.length 6) {
            
    problem true;
            var 
    problem += "\nPlease enter more then 6 chars in question [...]";
        }
        if(
    problem) {
            
    alert("There is atleast one problem!");
            
    alert("Problem(s):\n" problem);
       }

    etc.

    Shaffer.

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Code:
    <script type="text/javascript">
    var message='Please enter more then 6 chars!';
    var a=prompt('For the first prompt, type the BACKGROUND-COLOR of your site','');
    while(a.length<6 || a==message){
    a=prompt('For the first prompt, type the BACKGROUND-COLOR of your site',message)
    }
    </script>
    Quote Originally Posted by Shaffer
    According to the w3c, you should have the script type "lang/text", rather "text\lang".
    In fact according to the w3c the language="javascript" is already deprecated
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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