How can I call asp page with parameters from html link?

感情迁移 提交于 2019-12-12 03:38:15

问题


I´m trying to call asp page from html link but with paremeters. Is that possible?

<li><a href="#" onclick="<% Response.redirect("myurl with parameters")%>">Caducados</a></li>

I know why this fails but is there any way to do this?


回答1:


You can pass them in a conventional link;

 <a href="page.asp?a=b&c=<%=serverval %>&d=e">Caducados</a>

If you need client side processing

 <a href="#" onclick="goTo('val1', '<%=serverval %>');">Caducados</a>

and a js helper;

 function goTo(a,b) {
   location.href = "page.asp?a=" + a + "&b= ....



回答2:


I think you are trying to do something like this:

<li><a href="mypage.asp?param1=value1&param2=value2">Caducados</a></li>



回答3:


Here is the answer. Thanks Alex K and My other Me

<% 
  id_usuario= Request.QueryString("usuario")
%>
<script type="text/javascript">

    function goTo () {
    var a = <%=id_usuario%>
    alert(a)        
    }
</script>

and then call goTo function from onclick event in html link



来源:https://stackoverflow.com/questions/11793891/how-can-i-call-asp-page-with-parameters-from-html-link

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!