QUOTE(vizskywalker @ Mar 27 2005, 02:20 AM)
Okay, I know how to use cgi or php to make sure a form is filled out the way I want, and if not, post up a page marking what needs to be fixed. I also know how to make a javascript to alert what needs to be fixed and not procede until they are fixed. What I want to do is use javascript to mark everything that needs to be fixed without using alerts, probably by changing the color. Any ideas as to how to do this?
Below is a verifier java script:
You should copy and paste below code to head
<script language="JavaScript1.2">
// JavaScript Document
// Pars Loyal Alert
function opensentwin(openurl)
{
window.open(openurl,null,'width=540,height=150,scrollbars=no,left=200,top=200');
}
function check_empty() //cheek name field
{
if (form.name.value=="")
{
alert(“Please insert your name");//display alert message
form.name.focus();
return false;
}
if (form.mail.value=="")//cheek mail field
{
alert("Please insert your email");//display alert message
form.mail.focus();
return false;
}
//cheek that email be correct
if (form.mail.value.indexOf('@')<=0 || form.mail.value.indexOf('@')==form.mail.value.length-1 )
{
alert("youremail@site.com ");//display alert message
form.mail.focus();
return false;
}
} </script>
you should add following code as your submit button:
<input name="submit" type=submit onclick="return check_empty()" VALUE="Submit">
and you should set below properties to your fields
<input type=text name="name" size="10">
<input type=text name="mail" size="10">
you can change and modify code
you can test code on my site
http://www.parsloyal.com/wallpaper/wallpaper.php
Reply