Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-13-2007, 01:05 PM   PM User | #1
codingmasta
New Coder

 
Join Date: Dec 2006
Location: Bahrain
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
codingmasta has a little shameless behaviour in the past
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> 
__________________
ALWAYS remember to validate your code

Last edited by codingmasta; 01-13-2007 at 02:00 PM..
codingmasta is offline   Reply With Quote
Old 01-13-2007, 06:24 PM   PM User | #2
Shaffer
New Coder

 
Join Date: Oct 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Shaffer has a little shameless behaviour in the past
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.
Shaffer is offline   Reply With Quote
Old 01-13-2007, 08:52 PM   PM User | #3
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
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
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:45 PM.


Advertisement
Log in to turn off these ads.