Skip to main content

SCRIPT VALIDATION

<script>
function checknull()
{

if(document.query.name.value=="")
{
 alert('Please Enter Name');
  document.query.name.focus();
 return false;
}

var x=document.forms["query"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
  {
  alert("Not a valid e-mail address");
  return false;
  }

/*
if (document.query.mobile.value=="")
{
 alert('Please Enter Mobile No.');
 document.query.mobile.focus();
 return false;
}

*/
//if ((document.query.mobile.value=="") || (isNaN(document.query.mobile.value)) || (document.query.mobile.value.length!=10))

if (document.query.mobile.value=="" || isNaN(document.query.mobile.value) || document.query.mobile.value.length!=10)
{
 alert('Please Enter Mobile No.');
 document.query.mobile.focus();
 return false;
}




if (document.query.city.value=="")
{
   alert('Please Enter City Name');
      document.query.city.focus();
 return false;
}

if(document.query.course.value=="")
{
 alert('Please Enter Course Name');
 document.query.course.focus();
 return false;
}

if(document.query.message.value=="")
{
 alert('Please Enter Your Query');
 document.query.message.focus();
 return false;
}

alert("Thank you for showing intrest in us. Shortly You will get call from us.");
}
</script>
</head>

<body>
<table width="225" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><table width="225" height="400" border="0" cellpadding="0" cellspacing="0" background="images/roundcornertopbg2.jpg">
      <tr>
        <td width="270" align="center" valign="top" class="style35"><table width="220" height="90" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#DFDBDA">
            <tr>
              <td><img src="images/caller.jpg" width="220" height="90" border="0" /></td>
            </tr>
          </table>
            <form action="addenquiry.php" method="post" name="query" id="query" onsubmit="return checknull();">
              <table width="200" border="0" cellpadding="0" cellspacing="0">
                <tbody>
                  <tr>
                    <td align="left" class="style14"><span class="style36">Name</span><br />
                        <input name="name" type="text" class="formborder" id="name" size="26" />
                    </td>
                  </tr>
                  <tr>
                    <td align="left"><span class="style37">E-Mail</span><br /> <span class="style229">
                      <input name="email" type="text" class="formborder" id="email" size="26" />
                      </span></td>
                  </tr>
                  <tr>
                    <td align="left"><span class="style229"> <span class="style14">Mobile No. </span><br />
                          <input name="mobile" type="text" class="formborder" id="mobile" size="26" />
                    </span></td>
                  </tr>
                  <tr>
                    <td align="left"><span class="style229"> <span class="style14">City</span><br />
                          <input name="city" type="text" class="formborder" id="city" size="26" />
                    </span></td>
                  </tr>
                  <tr>
                    <td align="left" width="66%"><span class="style229"> <span class="style14">Interested Course </span><br />
                          <input name="course" type="text" class="formborder" id="course" size="26" />
                    </span></td>
                  </tr>
                  <tr>
                    <td align="left" width="66%"><span class="style229"> <span class="style14">Query</span><br />
                          <textarea name="message" cols="23" rows="2" class="formborder" id="message" style="font-family:arial;font-size:10pt"></textarea>
                    </span></td>
                  </tr>
                  <tr>
                    <td align="left"><span class="style229">
                      <label>
                      <input name="mobilealert" type="radio" value="yes" checked="checked" />
                      <span class="style128">Agree to recieve Call / Mail</span></label>
                    </span></td>
                  </tr>
                  <tr>
                    <td align="left"><span class="style229">
                      <input type="submit" name="Submit2" value="Submit">
                    </span></td>
                  </tr>
                </tbody>
              </table>
            </form></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="30">&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><table width="200" height="250" border="0" cellpadding="5" cellspacing="0" background="images\bg4.jpg" bgcolor="#666666">
      <tr>
        <td valign="top"><p align="center" class="style19 style48">Speak to our career counsellors to know best career options for you based on your potentiality. </p>
            <table width="180" height="100" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td align="center" valign="middle"><marquee height="80" direction="up" scrollamount="1" loop="-1">
                  <span class="style175">Call : 7303 73 0033 </span>
                  </marquee>
                </td>
              </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<br />
<br />
</body>
</html>

Comments

Popular posts from this blog

LECTURE BREAKUP OF PHP MYSQL

PHP+MYSQL Introduction Basic Syntax Variable & it's Scope I/O & Comment   String & it's Function Operator & Expression Decision Control Case Control Loop Control Arrays & Function Form Handling State Management - Cookies State Management - Session Mail Concept Working with File Date/Time Functions Introduction MySQL Environment Database Concept Datatype Query processing Statements  Query processing based on condition Database Connectivity Database Operation With GUI Import/Export Database

SCRIPT CODE FOR VALIDATION

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>form</title> <style type="text/css"> <!-- .style1 {color: #FF0000} --> </style> <script> function valid() { tname=document.frm.name.value; teid=document.frm.email.value; tmno=document.frm.phone.value; tmsg=document.frm.comment.value; if(tname=="") { alert("Pls. Fill Name"); document.frm.name.focus(); return false; } else if(teid=="") { alert("Pls. Fill Email"); document.frm.email.focus(); return false; } else if(tmno=="") { alert("Pls. Fill Mobile no"); document.frm.phone.focus(); return false; } else if(isNaN(tmno)) { alert(...

DIALOG BOX SHOW CODE IN SWING JAVA

import javax.swing.*; import java.awt.event.*; public class Dialog {   JFrame frame;   JPanel p;   public Dialog(){   frame = new JFrame("Show Message Dialog");   p=new JPanel();   JButton button = new JButton("Click Me");   button.addActionListener(new MyAction());     p.add(button);   frame.add(p);   frame.setSize(400, 400);   frame.setVisible(true);   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   }   public class MyAction implements ActionListener{   public void actionPerformed(ActionEvent e){   JOptionPane.showMessageDialog(frame,"My DialogBox");   }   }  public static void main(String[] args)  {     Dialog db = new Dialog();   } }