`
lichen0921
  • 浏览: 79513 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

下拉框默认值动态选定

阅读更多
<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>

标签里添加selected即表示默认选定值

但如何用程序控制,也就是动态生成默认值呢?

网上找了半天都没有直接适合的,不过受到了启发,很简单的实现了,如下代码实现:

用户选择月份,验证输入不合法后返回,下拉框里的默认值更改为用户刚刚选择的

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics