Jump to content

srinivas g

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by srinivas g

  1. Try this code .....

     

    Mainpage : EmailUs.html

     

    <html><head>

    <script type="text/javascript" src = "Validation.js"></script>
    </head>
    <body>
    <div>
    <center><p><form name="HelpDesk" method = "post" action = "mailTo.php" onsubmit="return validation()">
    <table width="36%" border="0" cellpadding="3" cellspacing="3" align="center"><tr><td height="15" align="right" >
    Contact No.</td><td><input name="txtPhone" maxlength="15" type="text" /></td></tr><tr><td height="15" align="right" >Email id</td><td><input type='text' name='txtEmail'/></td></tr><tr><td height="15" align="right" >Query</td><td><textarea name="txtDescription" rows="5" cols="30" maxlength="500" alt="write your query here"></textarea></td></tr></table>
    <input type="submit" value="Submit"> <input type="reset" name="reset" value="Reset">
    </form></p></center>
    </div>
    </body>
    </html>
    Validation page : Validation.js
    // Declaring required variables
    var digits = "0123456789";
    // non-digit characters which are allowed in phone numbers
    var phoneNumberDelimiters = "()- ";
    // characters which are allowed in international phone numbers
    // (a leading + is OK)
    var validWorldPhoneChars = phoneNumberDelimiters + "+";
    // Minimum no of digits in an international phone no.
    var minDigitsInIPhoneNumber = 10;
    function isInteger(s)
    { var i;
    for (i = 0; i < s.length; i++)
    {
    // Check that current character is number.
    var c = s.charAt(i);
    if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
    }
    function trim(s)
    { var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    {
    // Check that current character isn't whitespace.
    var c = s.charAt(i);
    if (c != " ") returnString += c;
    }
    return returnString;
    }
    function stripCharsInBag(s, bag)
    { var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {
    // Check that current character isn't whitespace.
    var c = s.charAt(i);
    if (bag.indexOf© == -1) returnString += c;
    }
    return returnString;
    }
    function checkInternationalPhone(strPhone){
    var bracket=3
    strPhone=trim(strPhone)
    if(strPhone.indexOf("+")>1) return false
    if(strPhone.indexOf("-")!=-1)bracket=bracket+1
    if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
    var brchr=strPhone.indexOf("(")
    if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
    if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
    s=stripCharsInBag(strPhone,validWorldPhoneChars);
    return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
    }
    function validation()
    {
    var txtForm=document.HelpDesk;
    var Phone=txtForm.txtPhone;
    var email = txtForm.txtEmail;
    var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
    if ((Phone.value==null)||(Phone.value==''))
    {
    alert("Please Enter your Phone Number")
    Phone.focus();
    return false;
    }
    else if (checkInternationalPhone(Phone.value)==false)
    {
    alert("Please Enter a Valid Phone Number")
    Phone.value="";
    Phone.focus();
    return false;
    }
    else if ((email.value==null)||(email.value==''))
    {
    alert('Please provide a valid email address');
    email.focus();
    return false;
    }
    else if (!filter.test(email.value))
    {
    alert('Please provide a valid email address');
    email.value="";
    email.focus();
    return false;
    }
    else if(txtForm.txtDescription.value=='')
    {
    alert(" Please write your query");
    txtForm.txtDescription.focus();
    return false;
    }
    }
    Targetpage: EmailTo.php
    <?PHP
    $email = "desired email id"; // write ur email id here
    $strTo = $email;//$_POST["txtTo"];
    $strSubject = " Sender id : ".$_POST["txtEmail"];
    $strMessage = "<b>Query : -</b> ".nl2br($_POST["txtDescription"]);
    //*** Uniqid Session ***//
    $strSid = md5(uniqid(time()));
    $strHeader = "";
    $strHeader .= "From: ".$_POST["txtPhone"]."<".$_POST["txtEmail"].">nReply-To: ".$_POST["txtPhone"]."";
    $strHeader .= "MIME-Version: 1.0n";
    $strHeader .= "Content-Type: multipart/mixed; boundary="".$strSid.""nn";
    $strHeader .= "This is a multi-part message in MIME format.n";
    $strHeader .= "--".$strSid."n";
    $strHeader .= "Content-type: text/html; charset=utf-8n";
    $strHeader .= "Content-Transfer-Encoding: 7bitnn";
    $strHeader .= $strMessage."nn";
    $flgSend = @mail($strTo,$strSubject,null,$strHeader); // @ = No Show Error //
    if($flgSend)
    {
    ?>
    <script>
    alert("message has been sent successfully..!");
    window.location.href = 'http://yor web page'; // put ur URL
    </script>
    <?PHP
    }
    else
    {
    ?>
    <!-- if message sending failed then below message will be displayed-->
    <script>
    alert("message sending failed..");
    window.location.href = 'http://your web page URL';
    </script>
    <?PHP
    }
    ?>

     

  2. Hi dsonesuk, it is center in horizontally and about vertically means height of ur webpage .. my code is for center regardless of height .. if u know the height u can adjust as u wish ... for each query there is a separate code... so DIV center that too horizontally until know the height

  3. Hi try this code, by changing below div color value entire elements (exclusive of anchor) color will be change. What is ur problem exactly?
    <html><head><style>
    .B {color:#FF0909;} // put A instead of class B
    </style></head>
    <body>
    <div class="A">
    <div class="B">
    <h1>Lorem ipsum</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis, deserunt, ipsam, magni ex architecto id harum repudiandae cumque modi dolorum obcaecati tempora eius ad et perferendis ratione eum mollitia adipisci.</p>
    <a href ="#0" class="button readmore">Citeste tot</a>
    </div>
    </div>
    </body>
    </html>
×
×
  • Create New...