加载中...
查看文章
  • 按钮链接乾坤大挪移
  • 作者:未知 来源:未知 添加时间:2004年4月9日 字体:
  • 83790作为一个小技巧,暂时归类到ASP中。
    gK}eOq

    在设计网站的时,我gK}eOq 们可能会想把链接做成按钮的样子,按钮做成链接的样子。下面说一下我gK}eOq 的方法。

    gK}eOq 1、按钮做成链接(图片)的样子

    gK}eOq 提交按钮<input type="submit" &#118alue="提交">

    gK}eOq 提交链接<a href="#" &#111nclick="表单名字.submit()">提交</a>


    gK}eOq

    重置按钮<input type="reset" &#118alue="重置">

    gK}eOq 重置链接<a href="#" &#111nclick="表单名字.reset()">重置</a>


    gK}eOq

    普通按钮<input type="button" &#118alue="按钮" &#111nclick="函数()">

    gK}eOq 普通链接<a href="#" &#111nclick="函数()">链接</a>


    gK}eOq

    至于图片也一样把a标签换成img


    gK}eOq

    2、链接做成按钮的样子

    gK}eOq <a href="reg.asp">注册</a>

    gK}eOq =><input type="button" &#118alue="注册" &#111nclick="location.href='reg.asp'">


    gK}eOq

    -----------------------------------

    gK}eOq 有的时候我gK}eOq 们完全可以手工做一个get方式的表单,至于用按钮还是链接随心所欲。

    gK}eOq <form action="xx.asp" method="get" name="form1">

    gK}eOq <input name="aa" type="text" id="aa">

    gK}eOq <input name="bb" type="text" id="bb">

    gK}eOq <input type="submit" name="Submit" &#118alue="提交">

    gK}eOq </form>

    gK}eOq =>

    gK}eOq <input name="aa" type="text" id="aa">

    gK}eOq <input name="bb" type="text" id="bb">

    gK}eOq <input type="button" &#118alue="按钮" &#111nclick="location.href='xx.asp?aa='+document.all['aa'].&#118alue+'&bb='+document.all['bb'].&#118alue">

    gK}eOq -----------------------------------

    gK}eOq 进一步说我gK}eOq 们还可以做一个按钮(链接)来同时传递js变量,表单input的值,asp变量,Recordset值

    gK}eOq <script language="javascript">

    gK}eOq var id1=1;

    gK}eOq </script>

    gK}eOq <%

    gK}eOq id3=3

    gK}eOq ....

    gK}eOq rs.open exec,conn,1,1

    gK}eOq 假设有rs("id4")=4

    gK}eOq ...

    gK}eOq %>

    gK}eOq <input name="id2" type="text" id="id2" &#118alue="2">

    gK}eOq <input type="button" &#118alue="按钮"

    gK}eOq &#111nclick="location.href='xx.asp?id1='+id1+'&id2='+document.all['id2'].&#118alue+'&id3=<%=id3%>&id4=<%=rs("id4")%>'">

    gK}eOq gK}eOq 们按下按钮会看到浏览器的url是xx.asp?id1=1&id2=2&id3=3&id4=4

    gK}eOq 在xx.asp中我gK}eOq 们就可以用request.querystring来得到所有变量,这样是不是变相的客户端js和服务器段的变量传递?


    gK}eOq


    gK}eOq 83787
  • 返回页面顶端
  • 上一篇:一个实用的ASP分页函数,解决你重复写分页代码的烦恼
  • 下一篇:SQL注入天书 - ASP注入漏洞全接触
  • 返回上一页 打印本文 加入收藏
  • 页面最后更新时间:2011年5月18日