在设计网站的时,我gK}eOq们可能会想把链接做成按钮的样子,按钮做成链接的样子。下面说一下我gK}eOq的方法。
gK}eOq 1、按钮做成链接(图片)的样子
gK}eOq 提交按钮<input type="submit" &#118alue="提交">
gK}eOq 提交链接<a href="#" &#111nclick="表单名字.submit()">提交</a>
重置按钮<input type="reset" &#118alue="重置">
gK}eOq 重置链接<a href="#" &#111nclick="表单名字.reset()">重置</a>
普通按钮<input type="button" &#118alue="按钮" &#111nclick="函数()">
gK}eOq 普通链接<a href="#" &#111nclick="函数()">链接</a>
至于图片也一样把a标签换成img
2、链接做成按钮的样子
gK}eOq <a href="reg.asp">注册</a>
gK}eOq =><input type="button" &#118alue="注册" &#111nclick="location.href='reg.asp'">
-----------------------------------
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和服务器段的变量传递?