后台调用js
原本的程序是
function doubleclick() {
var job_id, cid, cust_id, from;
job_id =document.getElementById("Label1").innerText;
cid = document.getElementById("Label2").innerText;
cust_id = document.getElementById("Label3").innerText;
from = "";
OpenJob(job_id, cid, cust_id, from);
}
function OpenJob(jobid,cid,cust_id,from)
{
}
我想改成后台调用js,protected void btn_jump_Click(object sender, EventArgs e)
{
string job_id, cid, cust_id, from;
job_id = Label1.Text;
cid = Label2.Text;
cust_id = Label3.Text;
from = "";
// Page.RegisterClientScriptBlock("OpenJob", "<script>OpenJob("+job_id+", "+cid+", "+cust_id+", "+from+")</script>");
// this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script>OpenJob(" + job_id + ", " + cid + ", " + cust_id + ", " + from + ");</script>", true);
// Page.ClientScript.RegisterStartupScript(GetType(), "OpenJob", "OpenJob(" + job_id + ", " + cid + ", " + cust_id + ", " + from + ");", true);
ClientScript.RegisterStartupScript(ClientScript.GetType(), "OpenJob", "<script>OpenJob(" + job_id + ", " + cid + ", " + cust_id + ", " + from + ");</script>");
// Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>OpenJob(job_id, cid, cust_id, from)</script>", true);
// Page.RegisterStartupScript("OpenJob", "<script>OpenJob(job_id, cid, cust_id, from)</script>");
// OpenJob(job_id, cid, cust_id, from);
}
结果程序怎么都不对。直觉告诉我应该是调用js的时候参数传递的那段语句写错了。。。
菜鸟求指导应该怎么写。。。。。 js
[解决办法]
Button1.Attributes.Add("onclick", "doubleclick()");