js调用后台有参数但无返回值的方法

JavaScript08

js调用后台有参数但无返回值的方法,第1张

呵呵方法是你有的

一种就是用ajax

另一种你可以页面上建立一个iframe并把这个iframe设置为不可见的

把你的地址和参数,都赋值于iframe的src属性

,然后通过iframe把值传到后台

把C#里面的js脚本写成函数,在c#代码中调用open()函数输出脚本,在js甲苯直接调用c#输出的函数就行了

protected void Open(){Filter() ClientScript.RegisterClientScriptBlock(this.GetType(), "selectValue", "function SelectValue(){window.open('SelectValue.aspx', 'selectValue', 'height=100, width=200, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no')}", true) }JS方法:function returnConfirm() {var tab = document.getElementById("ctl00_ContentPlaceHolder1_GridView1") var ischeck = false for (var i = 0i <tab.rows.lengthi++) {if (tab.rows[i].cells[0].childNodes[0].checked == true) {ischeck = true }}if (ischeck) {if (confirm("Whether to export your selected MAWB All HAWB record?")) {return true } else {SelectValue() return false }}}