jsjava下拉列表框代码居中代码

js 下拉列表相关问题 如何动态设置动态列表中的值并显示_百度知道
js 下拉列表相关问题 如何动态设置动态列表中的值并显示
#check').val()两个下拉列表
当选择其中一个下拉列表中的一项时
隐藏第二个下拉列表
如果之前操作过将被隐藏的下拉列表
将被隐藏的下拉列表不是为初始状态 如何能再操作第一个下拉列表后 显示被隐藏的下拉列表将 这个列表的值设置为初始值var check = $(&#39
提问者采纳
你将初始值保存在一个变量里面,当再次显示的时候就给他赋值为变量的值。
值我可以设置
但是页面没有反应 他不会刷新
请问有什么功能改变那个值
那你最好是有一个js框架吧,那些框架实现异步就很简单了
提问者评价
自己找到方法了 那个比较墨迹 不过谢谢你了
其他类似问题
为您推荐:
您可能关注的推广回答者:
下拉列表的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁当前位置:&>&&>&&>&
更换select下拉菜单背景样式的js代码
发布时间:编辑:
本文介绍一个可以对select下拉菜单背景样式进行更换的js代码,供大家学习参考。
html页面中,对select加上背景色,会显得更美观,本文就为大家介绍一个实现的方法。
1、css代码
复制代码 代码示例:
&style type=&text/css&&
.uboxstyle{width:174height:39 float:}
#uboxstyle{width:174height:39 float:}
#uboxstyle .select_box{width:174height:39 float:}
#uboxstyle div.tag_select{display:color:#79A2BD;width:174height:39background:transparent url(&images/select01.jpg&) no-repeat 0 0;padding:0 10:39}
#uboxstyle div.tag_select_hover{display:color:#79A2BD;width:174height:39background:transparent url(&images/select01.jpg&) no-repeat 0 0;padding:0 10line-height:39 }
#uboxstyle div.tag_select_open{display:color:#79A2BD;width:174height:39background:transparent url(&images/select01.jpg&) no-repeat 0 0padding:0 10line-height:39}
#uboxstyle ul.tag_options{padding:0;margin:0;list-style:width:174padding:0 0 5margin:0;}
#uboxstyle ul.tag_options li{display:width:174padding:0 10height:30text-decoration:line-height:30color:#79A2BD;text-align:}
#uboxstyle ul.tag_options li.open_hover{color:#000}
#uboxstyle ul.tag_options li.open_selected{color:#000}
复制代码 代码示例:
&script language=&JavaScript&&
&* 动态更新select下拉菜单背景样式
var selects = document.getElementsByTagName('select');
var isIE = (document.all && window.ActiveXObject && !window.opera) ? true :
function $(id) {
return document.getElementById(id);
function stopBubbling (ev) {
ev.stopPropagation();
function rSelects() {
for (i=0;i&selects.i++){
selects[i].style.display = 'none';
select_tag = document.createElement('div');
select_tag.id = 'select_' + selects[i].
select_tag.className = 'select_box';
selects[i].parentNode.insertBefore(select_tag,selects[i]);
select_info = document.createElement('div');
select_info.id = 'select_info_' + selects[i].
select_info.className='tag_select';
select_info.style.cursor='pointer';
select_tag.appendChild(select_info);
select_ul = document.createElement('ul');
select_ul.id = 'options_' + selects[i].
select_ul.className = 'tag_options';
select_ul.style.position='absolute';
select_ul.style.display='none';
select_ul.style.zIndex='999';
select_tag.appendChild(select_ul);
rOptions(i,selects[i].name);
mouseSelects(selects[i].name);
if (isIE){
selects[i].onclick = new Function(&clickLabels3('&+selects[i].name+&');window.event.cancelBubble =&);
else if(!isIE){
selects[i].onclick = new Function(&clickLabels3('&+selects[i].name+&')&);
selects[i].addEventListener(&click&, stopBubbling, false);
function rOptions(i, name) {
var options = selects[i].getElementsByTagName('option');
var options_ul = 'options_' +
for (n=0;n&selects[i].options.n++){
option_li = document.createElement('li');
option_li.style.cursor='pointer';
option_li.className='open';
$(options_ul).appendChild(option_li);
option_text = document.createTextNode(selects[i].options[n].text);
option_li.appendChild(option_text);
option_selected = selects[i].options[n].
if(option_selected){
option_li.className='open_selected';
option_li.id='selected_' +
$('select_info_' + name).appendChild(document.createTextNode(option_li.innerHTML));
option_li.onmouseover = function(){ this.className='open_hover';}
option_li.onmouseout = function(){
if(this.id=='selected_' + name){
this.className='open_selected';
this.className='open';
option_li.onclick = new Function(&clickOptions(&+i+&,&+n+&,'&+selects[i].name+&')&);
function mouseSelects(name){
var sincn = 'select_info_' +
$(sincn).onmouseover = function(){ if(this.className=='tag_select')this.className='tag_select_hover'; }
$(sincn).onmouseout = function(){ if(this.className=='tag_select_hover') this.className='tag_select'; }
if (isIE){
$(sincn).onclick = new Function(&clickSelects('&+name+&');window.event.cancelBubble =&);
else if(!isIE){
$(sincn).onclick = new Function(&clickSelects('&+name+&');&);
$('select_info_' +name).addEventListener(&click&, stopBubbling, false);
function clickSelects(name){
var sincn = 'select_info_' +
var sinul = 'options_' +
for (i=0;i&selects.i++){
if(selects[i].name == name){
if( $(sincn).className =='tag_select_hover'){
$(sincn).className ='tag_select_open';
$(sinul).style.display = '';
else if( $(sincn).className =='tag_select_open'){
$(sincn).className = 'tag_select_hover';
$(sinul).style.display = 'none';
$('select_info_' + selects[i].name).className = 'tag_select';
$('options_' + selects[i].name).style.display = 'none';
function clickOptions(i, n, name){
var li = $('options_' + name).getElementsByTagName('li');
$('selected_' + name).className='open';
$('selected_' + name).id='';
li[n].id='selected_' +
li[n].className='open_hover';
$('select_' + name).removeChild($('select_info_' + name));
select_info = document.createElement('div');
select_info.id = 'select_info_' +
select_info.className='tag_select';
select_info.style.cursor='pointer';
$('options_' + name).parentNode.insertBefore(select_info,$('options_' + name));
mouseSelects(name);
$('select_info_' + name).appendChild(document.createTextNode(li[n].innerHTML));
$( 'options_' + name ).style.display = 'none' ;
$( 'select_info_' + name ).className = 'tag_select';
selects[i].options[n].selected = 'selected';
window.onload = function(e) {
bodyclick = document.getElementsByTagName('body').item(0);
rSelects();
bodyclick.onclick = function(){
for (i=0;i&selects.i++){
$('select_info_' + selects[i].name).className = 'tag_select';
$('options_' + selects[i].name).style.display = 'none';
&div style=&width:500&&
&form id=&form1& name=&form1& method=&post& action=&?Action=Select& style=&padding:0&&
&div style=&width:200 float: text-align: margin-top:8&&
&div id=&uboxstyle&&
&select name=&select1& id=&language&&
&option value=&1&&Cars...&/option&
&div style=&width:200 float:text-align:margin-top:8&&
&div id=&uboxstyle&&
&select name=&select2& id=&language2&&
&option value=&&&all&/option&
&div style=&width:100 float:left&&
&input type=&submit& name=&button& id=&button& value=&& style=&background-image:url(images/selectbt.jpg); width:92 height:38 border:0 cursor:& /&
&/form&&/div&
注意,代码中用到的背景图片,大家自行准备。
您可能感兴趣的文章:
与 更换select下拉菜单背景样式的js代码 有关的文章
本文标题:
本页链接:
12345678910
12345678910当前位置: >
化繁为简,我们帮助您更好的运用代码。给你的代码都是选之又选,懒人图库拒绝滥竽充数!    
菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航菜单导航
猜你也喜欢看这些 ??????
这些是最新的...
我们一直在进步下拉框选择改变时进行跳转的js特效
-js教程-ab蓝学网
当前位置: &
下拉框选择改变时进行跳转的js特效
简介:WEB前端|以下是引用片段:&selectname="select"style="width:100"onchange="javascript:window.open(this.options[thi...
以下是引用片段:
&select name="select" style="width:100" onchange="javascript:window.open(this.options[this.selectedIndex].value)"&
&option selected&我的网站&/option&
&option value="/"&ab蓝学网&/option&
&option value="/"&ab蓝学网壁纸&/option&
&option value="/bbs"&ab蓝学网论坛&/option&
转载注明本文地址:
如果觉得《下拉框选择改变时进行跳转的js特效
》不错,请把本站告诉您身边的朋友!
上一编:下一编:
正在加载 下拉框选择改变时进行跳转的js特效

我要回帖

更多关于 下拉列表文字居中 的文章

 

随机推荐