从输入框和下拉菜单的查询字符串中获取值
您好,我有以下带有查询字符串的页面: http://userpages.umbc.edu/~andrade1/ querystring/querystring/example1%20-%20Copy.html
当我单击“显示”并转到此处的接收页面时: http://userpages. umbc.edu/~andrade1/querystring/querystring/example123.html?name=Duck%2C%20Donald&spouse=Daisy
如何检索查询字符串,以便下拉菜单显示名称 donald鸭子或米奇,具体取决于单击的按钮,输入框将显示米妮或雏菊,具体取决于单击的按钮?
例如,当单击米老鼠的显示按钮时,我希望米老鼠显示在下拉菜单中,但在页面加载后仍然能够选择其他选项,我希望米妮显示在输入框中,但能够还可以输入另一个值。
目前我使用的 JavaScript 是:
<script type="text/javascript">
<!--
document.write("Name: " + Request.QueryString("spouse"));
// -->
</script>
它不适用于下拉菜单或输入框
Hi I have the following page with a query string:
http://userpages.umbc.edu/~andrade1/querystring/querystring/example1%20-%20Copy.html
when I click show and go to the receiving page which is here:
http://userpages.umbc.edu/~andrade1/querystring/querystring/example123.html?name=Duck%2C%20Donald&spouse=Daisy
How can I retrieve the query string so that the drop down menu will display the name which is donald duck or mickey depending which button was clicked and the input box will display either minnie or daisy depending which button was clicked?
For example when the show button for mickey mouse is clicked I want mickey mouse to display in the drop down menu but still be able to select other options after the page is loaded and I would like minnie to display in the input box but be able to also type in another value.
Currently the javascript that I am using is:
<script type="text/javascript">
<!--
document.write("Name: " + Request.QueryString("spouse"));
// -->
</script>
which does not work for a drop down menu or input box
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 location.search
JavaScript 查询字符串
use location.search
JavaScript query string