html下拉Java脚本代码 [英] html dropdown java script code

查看:67
本文介绍了html下拉Java脚本代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用html下拉列表.页面刷新后,html dropdownlist不会保留所选的值.我正在使用以下代码:


I am using html dropdown. html dropdownlist is not retaining the selected value after the page refresh. I am using the code below:

<select  önchange="window.open(this.options[this.selectedIndex].value,'_top')">
<option value="http://xyz.com ">A</option>
<option value=" ">B</option>
<option value="">C</option>



我可以将页面重定向到同一窗口中提到的值.但是下拉值并不会在刷新时保留所选的值.
例如:如果我从下拉菜单中选择B项目,则在重定向到B选项值后,它必须在下拉菜单中显示B.

任何人都可以让我知道javascript的上述代码.

感谢



I could redirect to the page in same window to the value mentioned. But dropdown value is not retaining the selected value on refresh.
For Ex: if i select B item from dropdown it has to display B in dropdown after redirecting to B option value.

Can any one please let me know javascript for the above code.

thanks

推荐答案

对于每个页面刷新,除非您使用cookie或hiddenvariable或viewstate记住它们,否则将重置这些值.请参考下面的链接以记住以前的状态.刷新时的页面.


http://homepages.ius.edu/rwisman/N342/html/Hidden.htm [ ^ ]


http://www.quirksmode.org/js/cookies.html [ http://msdn.microsoft.com/en-us/library/bb386448.aspx [ ^ ]
For every page refresh the values are reset unless you remember them using a cookie or hiddenvariable or viewstate.. Please refer the links below to remember the previous state of the page when refreshing..


http://homepages.ius.edu/rwisman/N342/html/Hidden.htm[^]


http://www.quirksmode.org/js/cookies.html[^]


http://msdn.microsoft.com/en-us/library/bb386448.aspx[^]


这篇关于html下拉Java脚本代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆