...

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



codingmasta
01-13-2007, 02:05 PM
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


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

Shaffer
01-13-2007, 07:24 PM
/*
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.

Kor
01-13-2007, 09:52 PM
<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>



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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum