function my_fav_quote_show_optin_form() {
if (!empty($_POST[ my_fav_quote_email ])) {
my_fav_quote_opt_in();
}
$out2 = ;
$out = <form action="" method="post" id="requestQuote"> ;
$out .= <table style="padding="0px" width="40px"> ;
$out .= <tr><td style="vertical-align: middle;">Message:<br></td><td><textarea placeholder="" name="my_fav_quote_message" id="my_fav_quote_message"></textarea></td></tr> ;
$out .= ;
$out .= <tr><td colspan="2"> ;
if ( function_exists( my_fav_quote_display ) ){
$out .= my_fav_quote_display();
}
if ( function_exists( my_fav_quote_display3 ) ){
$out .= my_fav_quote_display3();
}
$out .= </td></tr> ;
$out .= <tr><td colspan=2 align=center><input type="submit" value="Request Quote" onclick="return chk_validation()" style="background-color:#000;color:#FFF;padding:5px;margin-top:10px;border:none;cursor:pointer;"/> <input type="button" onclick="formReset()" value="Reset form" /></td></tr> ;
$out .= </table></form> ;
echo $out;
?>
<script language="javascript" type="text/javascript">
function formReset()
{
document.getElementById("requestQuote").reset();
}
//<![CDATA[
function validate_email(field,alerttxt)
{
apos=field.indexOf("@");
// alert(apos);
dotpos=field.lastIndexOf(".");
//alert(dotpos);
if (apos<1||dotpos-apos<2)
{ return false;}
else {return true;}
}
function chk_validation()
{
if(document.getElementById("my_fav_quote_name") && document.getElementById("my_fav_quote_name").value == )
{
alert("Please Enter Name");
document.getElementById("my_fav_quote_name").focus();
return false;
}
if(document.getElementById("my_fav_quote_email").value == )
{
alert("Please Enter Email");
document.getElementById("my_fav_quote_email").focus();
return false;
}
else
{
//alert(validate_email(document.getElementById("my_fav_quote_email").value,"Not a valid e-mail address!");
if (validate_email(document.getElementById("my_fav_quote_email").value,"Please enter valid e-mail address!")==false) {
alert("Please enter valid e-mail address!");
document.getElementById("my_fav_quote_email").focus();
return false;
}
}
if(document.getElementById("security_code").value == )
{
alert("Please Enter Security Code");
document.getElementById("security_code").focus();
return false;
}
if(document.getElementById("quotes").value == )
{
alert("Please add atleast one request quote");
document.getElementById("quotes").focus();
return false;
}
//return true;
}
//]]>
</script>
<?php
}
这是在php中写成的“快乐”一词的一种形式,即需要添加一个 re子,由他自己尝试。
function formReset()
{
document.getElementById("requestQuote").reset();
}
但是,这并不奏效。
http://plugins.svn.wordpress.org/quote-cart/trunk/quote-cart.php
I want to reset the form when the user click on reset button all the data that is displayed should be removed from all the feilds and from from (the two functions my_fav_quote_display3 &the my_fav_quote_display & ) which was not actually happening.
为什么我能够这样做?