window.location.href如何传递参数

 时间:2024-10-13 02:54:02

1、鼠标点击打开HBuidler软件,如图所示:

window.location.href如何传递参数

2、点击菜单栏新建-->Web项目,如图所示:

window.location.href如何传递参数

3、输入web项目名window,然后点击完成按钮,如图所示:

window.location.href如何传递参数

4、然后在html文件中键入代码:<!DOCTYPE html><挢旗扦渌;html> <head>稆糨孝汶; <meta charset="utf-8" /> <title>window.location.href如何传递参数?</title> </head> <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script> <script type="text/javascript">$(document).ready(function(){ $("#btn").click(function(){ var name=$("#name").val(); alert("需要传递的名字参数:"+name); window.location.href="index2.html?name="+name; });}); </script> <body> <button id="btn">传递参数</button> <form > 姓名:<input type="text" id="name" value="张三"/> </form> </body></html>

window.location.href如何传递参数

5、然后点击运行按钮--->浏览器运行,如图所示:

window.location.href如何传递参数

6、浏览器查看运行结果,然后点击传递参数按钮,如图所示:

window.location.href如何传递参数

7、可以看到弹出需要传递的参数为张三,如图所示:

window.location.href如何传递参数
  • powerdesigner 15.3 安装教程
  • vs如何读取xml文件
  • HTTP请求头查看方式
  • jQuery如何获取选中单选按钮radio的值
  • html如何对数据库进行行增删
  • 热门搜索
    泰国旅游买什么好 赔偿的意思 云卷云舒是什么意思 祝福的句子 小妮子是什么意思 衣柜用什么板材最好 scissors是什么意思 宵衣旰食的意思 有什么好玩的腾讯游戏 逝者如斯夫的意思