快速预览:
GridView无代码分页排序
GridView选中,编辑,取消,删除
GridView正反双向排序
GridView和下拉菜单DropDownList结合
GridView和CheckBox结合
鼠标移到GridView某一行时改变该行的背景色方法一
鼠标移到GridView某一行时改变该行的背景色方法二
GridView实现删除时弹出确认对话框
GridView实现自动编号
GridView实现自定义时间货币等字符串格式
GridView实现用“…”代替超长字符串
GridView一般换行与强制换行
GridView显示隐藏某一列
GridView弹出新页面/弹出新窗口
GridView固定表头(不用javascript只用CSS,2行代码,很好用)
GridView合并表头多重表头无错完美版(以合并3列3行举例)
GridView突出显示某一单元格(例如金额低于多少,分数不及格等)
GridView加入自动求和求平均值小计
GridView数据导入Excel/Excel数据读入GridView
GridView 18种操作
php将留言订单等表单内容发送到邮箱
上次实现了用asp将留言订单等发送到邮箱,今天客户提出英文站用的是linux空间,所以不支持Asp.只能用php实现了一个版本。注意编码要用utf-8
前台页面(同上一篇asp将留言订单发送到邮箱):
<form method=post action=’save.php’ name=”fw” onsubmit=’return checkform();’>
节省篇幅,表单元素,省略几个,实际可以放多个
<input name="comments" type="text" id="comments" size="30" class="reqfield" />
<input type="submit" name="Submit" value="submit">
</form>
save.php(php下面发邮件可以用mail()函数,但该函数要主机安装smtp服务器才能使用,所以不太常用,下面的这个组件,可以直接忽略空间上是否有smtp服务)
先从 http://phpmailer.worxware.com/ 下载phpmailer,复制class.phpmailer.php,class.smtp.php放在和save.php一块。
<?php
$comments = $_REQUEST['comments'];
$subject = "Your have a message from hkcat!";
$body = " comments:" . $comments ." date:" . date("Y-m-d H:i:s");
$to = mail@hkcat.org; //收件人邮箱
sendmail$to,$subject,$body);
function sendmail($to,$subject = "",$body = ""){
//$to 表示收件人地址 $subject 表示邮件标题 $body表示邮件正文
error_reporting(E_STRICT);
date_default_timezone_set("Asia/Shanghai"); //设定时区
require_once(‘class.phpmailer.php’);
include("class.smtp.php");
$mail = new PHPMailer(); //new一个PHPMailer对象出来
$body = eregi_replace("[\]",”,$body); //对邮件内容进行必要的过滤
$mail->CharSet ="UTF-8";//设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置,否则乱码
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
$mail->Host = "smtpcom.263xmail.com"; // SMTP 服务器
$mail->Port = 25; // SMTP服务器的端口号
$mail->Username = xxx@hkcat.org; // SMTP服务器用户名
$mail->Password = "hkcatpwd"; // SMTP服务器密码
$mail->SetFrom(‘seo@hkcat.org’, ‘诸暨seo’); //发件人地址
$mail->AddReplyTo(seo@hkcat.org,"诸暨seo"); //回复地址,设置成同上
$mail->Subject = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, "seo");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "<script language=’javascript’>alert(‘Send Success!’);window.location.href=’index.htm’</script>";
}
}
?>
asp将留言订单表单内容直接发送到邮箱
有些企业站没有专人经常登陆后台维护,所以对于网站上面提交的留言,订单等,都是采用直接发送到指定邮箱的。下面的代码需要jmail组件运行。
前台页面:
<form method=post action=’save.asp’ name=request_quote onsubmit=’return checkform();’>
节省篇幅,表单元素,省略几个,实际可以放多个
<input name=”comments” type=”text” id=”comments” size=”30″ class=”reqfield” />
<input type=”submit” name=”Submit” value=”submit”>
</form>
save.asp: 接收内容,发送到邮箱
comments=trim(request(“comments”))
E_Recip = “samwaysales@gmail.com” ‘收件人
E_Server = “smtpcom.263xmail.com” ‘邮件服务器地址
E_ServerUser = “xxx@hkcat.org” ‘邮件服务器帐号
E_ServerPass = “hkcatpwd” ‘邮件服务器密码
E_SendManMail = “fff@hkcat.org” ‘发件人地址
E_SendManName = “诸暨seo” ‘发件人姓名
E_Topic = “从企业站发来的邮件” ‘邮件标题
E_Body = comments:” & comments ‘邮件正文
Sub Jmail(Email,Topic,Mailbody)
On Error Resume Next
Dim JMail
Set JMail = Server.CreateObject(“JMail.Message”)
JMail.silent=true
JMail.Logging = True
JMail.Charset = “utf-8″
JMail.ContentType = “text/html”
JMail.Priority = 1
JMail.From = E_SendManMail
JMail.FromName = E_SendManName
JMail.MailServerUserName = E_ServerUser
JMail.MailServerPassword = E_ServerPass
JMail.Subject = Topic
JMail.Body = Mailbody
JMail.AddRecipient(Email)
JMail.Send (E_Server)
Set JMail = Nothing
SendMail = “OK”
If Err Then SendMail = “False”
JMail.Close()
Set JMail = Nothing
End Sub
Jmail E_Recip,E_Topic,E_Body
Response.Write “<script>alert(‘Thank You. Your Quote Request has been mailed successfully’);location.href=’product.htm’;</script>”
sql实现为空记录行或NULL字符行排在后面,前面按正常顺序排
今天遇到了一个小问题,客户要求有图片的产品排在前面,没有图片的产品排在后面。本来想用union的,后来还是搜索了下,发现:
select * from products order by case when picpath = ” then 1 else 0 end,productId desc
这个可以解决这个问题,在access中,需要用
SELECT * FROM products order by iif(picpath = ”,1,0),productId desc
access中的iif相当于sqlserver中的case when
我的第1个jquery,ajax应用,特此记念
<tr><td><input type="text" value="<%= discount %>" oldv="<%= discount%>" id=’cate_<%= cid %>’ onblur=’update(<%= cid %>,<%= userId%>);’/> 折</td>
<td><img src="../images/ajax_ok.gif" alt="" id=’message_<%= cid %>’/></td></tr>
flash添加右键菜单
添加右键菜单:
右键菜单 = new ContextMenu();
eval("右键菜单").hideBuiltInItems();
eval("右键菜单").customItems.push(new ContextMenuItem("test", dj_menu0, false));
_root.menu = eval("右键菜单");
javascript几点小注意
整理了下在工作中遇到的一些javascript的小备忘:
1. <input name=”ff” type=”button” value=”test” onClick=”ff();”/> 这种写法是错误的,因为有2个ff,导致错误。控件名称和事件名称不能一样。注意
2. hidden控件提交数据,一定要加上name属性
<input type=”hidden” name=”ff” id=”ff”/> 一定要加上name,否则asp获取不到值
3.
//判断数字
function isdigit(s)
{
var r,re;
re = /\d*/i; //\d表示数字,*表示匹配多个数字
r = s.match(re);
return (r==s)?1:0;
}
4. javascript模式对话框调用方法
var xx = showModalDialog(“../ImageAdd.aspx”, ‘window’, ‘dialogWidth:560px; dialogHeight:200px;help:0;status:0;resizeable:1;’);
5.
<div align=”center”><input type=”text” value=’2′></input> <a href=”#” onClick=’updateOrder(this,3)’>修改</a></div>
如果要获取input的值,需要先获取父节点,再得到其第一个子其点。而不能直接得到临近的上一个节点obj.previousSibling.value
var t = obj.parentNode.childNodes[0].value;
