这篇文章是在日常的工作中总结出来的,下面把四种参数传递的形式展示给大家。
什么时候用get, 查,删,
什么时候用post,增,改 (特列:登陆用post,因为不能让用户名和密码显示在url上)
4种get传参方式
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript"> function go() { window.location.href="localhost:21811/handler1.ashx?id=1&name='abc'" } </script> </head> <body>
<!--//参数传递的几种形式-->
<!--第一种:直接在url后面加参数:-->
<a href="localhost:21811/handler1.ashx?id=1&name='abc'">超链接传递参数</a></body>
<!--第三种:通过js方法传递:用户点击这个button按钮,触发onclick事件,执行go()方法,跳转到localhost:21811/handler1.ashx页面,同时传递了id,和name两个参数过去-->
<input type="button" onclick="go()" value="通过js方法传递参数" />
<!--第四种:通过form表单传递-->
<form action="handler1.ashx" method="get"><!--注意action里面的连接不能带参数的-->> <input type="text" name="id" value="3" /> <input type="text" name="name" value="abc" /> <input type="submit" value="通过传递参数" /> </form> </body> </html>
通过以上代码的介绍,相信大家都会喜欢的。
如对本文有疑问, 点击进行留言回复!!
轻松解决 org.apache.taglibs.standard.tlv.JstlCoreTLV 困惑
vert实践五——Json?Protocol Buffer?FlatBuffers?
[基于tensorflow的人脸检测] 基于神经网络的人脸检测8——验证训练好的神经网络
selenium + ajax抓取英雄联盟全部英雄的详细信息及多线程保存全部皮肤图片到本地
网友评论