手机版

jQuery实现选中弹出窗口选择框内容后赋值给文本框的方法

时间:2021-09-22 来源:互联网 编辑:宝哥软件园 浏览:

本文实例讲述了jQuery实现选中弹出窗口选择框内容后赋值给文本框的方法。分享给大家供大家参考,具体如下:

一、先描述下可以实现什么:

下拉框一改变,弹出框出现,选择弹出框中的值会赋值给下拉菜单

二、代码:

超文本标记语言头元http-equiv='内容-类型' Content=' text/html;charset=utf-8' titleSubscribe策略/title style type=' text/CSS ' * { margin : 0;padd : 0;} # bg { display:none位置:固定;_ position:absolute绝对值高度:100%;宽度:100%;top:0left:0背景技术: # 000;border:1px实心# cececez索引:1;} # logWin { display: none保证金-top :300;划水:0;位置:固定;_ position:absolutez索引:2;宽度宽度:230像素高度:140 pxborder:1px固体# c8 c8背景# fff飞越:汽车;} # logWin h2 { height:30px背景技术# c8c8c8文本对齐:居中;线高:30 pxcolor: # fff} #logWin表单{ margin :20 px 10px 10px } # LogWin .dataArea { margin-top :10 px;} #logWin .控制区域{边距-顶部:13 px边距-左侧:35像素;} #logWin .控制区域输入{ width :60 px }/style script src=' http : js/jquery。js ' type=' text/JavaScript '/script script type=' text/JavaScript '函数find it(msg){ var logStatus=0;if(msg==2)CheckWin(LogStatus);}函数Win center(){//将胜利居中到屏幕中心var窗口宽度=文档。文档元素。客户端宽度,窗口高度=文档。文档元素。客户端高度,scroltop=文档。文档元素。向上滚动,向左滚动=文档。文件。向左滚动,弹出窗口=$('#logWin ').width(),popupHeight=$('#logWin ').高度();$('#logWin ').css({ 'display' : 'block ',' position' : 'absolute ',' top ' : scroll top window height/2-popup health/2,' left ' : scroll left window width/2-popup width/2 });//只需要武力换IE6 $('#bg ').CSS({ ' height ' :窗口高度});}函数CheckWin(日志状态1){日志状态1=日志状态1;if(LogStatus==0){//如果窗口被禁用,则启用窗口CenteWin();$('#bg ').css({ '不透明度' : ' 0.5 ' });$('#bg ').fadeIn(' fast ');log STatus=1;} else {//禁用窗口$('#bg ').淡出(“快速”);$('#logWin ').淡出(“快速”);log STatus=0;} } $(function() { $('#no1,#no2,#no3,#no4 ').点击(function(){ var msg01=$(this)).text();$(' #角色').追加(“选择的选项=”选择的“msg 01”/“选项”);$('#logWin ').css({ 'display' : ' ',});});});/script/head body select name=' role _ select ' style=' width : 154 px ' id=' role ' class=' log in _ input ' on change=' find it(this。选项[这个。选项。selectedindex].值)'选项值=' 1 ' * * * * */选项选项值=' 1 ' * * * * * * */选项选项值='2 '输入/option/selectdiv id='logWin' h2点击你想输入的内容/H2 ul style='左边距=10px'列表式:无;Li id=' no1 ' NO1/Li Li id=' NO2 ' NO2/Li Li id=' NO3 ' NO3/Li Li id=' NO4 ' NO4/Li/ul/div/body/html希望本文所述对大家jQuery程序设计有所帮助。

版权声明:jQuery实现选中弹出窗口选择框内容后赋值给文本框的方法是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。