后台————————
protected void mytrsh_Click(object sender, EventArgs e)
{
string txtname = this.mytrsh.Text.Trim();
if (txtname == "打印")
{
问题在这? 要是== 打印的话·怎么才能执行下面的脚本啊。
}
前台——————————
<script type="text/javascript" language="javascript">
function printht(btnPrintID) {
var btnPrint = document.getElementById(btnPrintID);
pagesetup_null()
return false;
}
function pagesetup_null() {
try {
var RegWsh = new ActiveXObject("WScript.Shell")
hkey_key = "header"
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "")
hkey_key = "footer"
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "")
} catch (e) { }
window.print();
}
function ReturnView() {
window.location = 'ClfFrame.aspx';
}
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('111!') 这写方法名", true);
用JQuery ,不用后台写的,页面不刷新
$(document).ready(function () {
$("#btnPrint").click(function () {
if ($("#mytrsh").val() == "打印") {
alert("OK");
//printht();
}
});
});