本文介绍了如何添加javascript location.href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我需要现在当我有一个按钮&我需要将3个参数发送到其他页面我使用位置.href但是不工作这是我的代码请帮助我



< script>



function btnExternalPayGhest_Click(id){



if (id == 190){



location.href ='http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x= '+ GhestCompanyID +'&y ='+ ExternalGhestID +'&y ='+ ExternalCellPhone;



}



否则if(id == 240){



location.href ='http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx ?x ='+ GhestCompanyID +'&y ='+ ExternalGhestID +'&y ='+ ExternalCellPhone;



}



}

< / script>

< form name =form1>



< input type =buttonname =بررسیvalue =بررسی>



< / form>

hi i need to now when i have one button & i need to send 3 parameters to other page i use location .href but don't work this is my code please help me

<script >

function btnExternalPayGhest_Click(id) {

if (id == 190) {

location.href = 'http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x=' + GhestCompanyID +'&y='+ExternalGhestID +'&y=' +ExternalCellPhone;

}

else if (id == 240) {

location.href = 'http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x=' + GhestCompanyID + '&y=' + ExternalGhestID + '&y=' + ExternalCellPhone;

}

}
</script>
<form name="form1">

<input type="button" name="بررسی" value="بررسی" >

</form>

推荐答案

<form id="form1" runat="server">
 <div>
     <input type="text" id="GhestCompanyID" value="GhestCompanyID" />
     <input type="text" id="ExternalGhestID" value="ExternalGhestID" />
     <input type="text" id="ExternalCellPhone" value="ExternalCellPhone" />
     <input type="button" name="aaaa" value="bbbb" onclick="btnExternalPayGhest_Click(190)" />
 </div>
 </form>





和写脚本一样,





and write script like,

function btnExternalPayGhest_Click(id) {
     var GhestCompanyID = document.getElementById("GhestCompanyID").value;
     var ExternalGhestID = document.getElementById("ExternalGhestID").value;
     var ExternalCellPhone = document.getElementById("ExternalCellPhone").value;
     if (id== 190) {

         location.href = 'http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x=' + GhestCompanyID + '&y=' + ExternalGhestID + '&z=' + ExternalCellPhone;

         }

     else if (GhestCompanyID == 240) {

     location.href = 'http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x=' + GhestCompanyID + '&y=' + ExternalGhestID + '&z=' + ExternalCellPhone;

 }
}


这篇关于如何添加javascript location.href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 15:21