选择显示字体大小

关于如何动态地在同一页面实现两个互传(s1 s2)


我们常常会碰到这样一个问题: 如何将在同一页面上的一个<select>或<listbox>的值传到另一个<select>或<listbox>中 ?这是一个很烦人的问题。可是有时候你偏偏会遇到。 那什么办呢?

下面是我“烟酒”了一个上午, 现贴上来让大家共享。 用的方法是很笨也挺麻烦。不过总是有点成就感的。呵呵!大家看看, 指点指点.....

<&#37;@ language=vbscript &#37;>
<html>
<head>
<meta name=&quot;generator&quot; content=&quot;microsoft visual studio 6.0&quot;>
</head>
<script language=&quot;vbscript&quot;>

</script>
<body bgcolor=&quot;#ffffff&quot;>
<form name=&quot;form1&quot; action=&quot;test01.asp&quot; target=&quot;_self&quot;>
<p><textarea id=text01 name=text01></textarea></p>
<table>
<tr>
<td>
<select name=&quot;select1&quot; language=&quot;javascript&quot; size=5>
<option value=11111>11111</option>
<option value=22222>22222</option>
<option value=33333>33333</option>
</select>
</td>
<td>
<label onclick=do_select()><font color=#ff00dc><u>->> </u></font> </label><br><br>
<label onclick=do_select2()><font color=#ff00dc><u><<- </u></font> </label>
</td>
<&#37;
str=&quot;function do_select() {&quot; & vbcrlf & _
&quot;if (document.form1.select1.options.length > 0) {&quot;&vbcrlf&_
&quot;var j=0;&quot;&vbcrlf&_
&quot;for(var i=0;i<document.form1.select1.options.length;i++) {&quot;&vbcrlf & _
&quot;if(document.form1.select1.options(i).selected) {&quot;&vbcrlf& _
&quot;j=j+1; break&quot; & vbcrlf & &quot;}&quot;&vbcrlf & &quot;}&quot;&vbcrlf& _
&quot;if (j > 0) {&quot;&vbcrlf&_ &quot;document.form1.sel2.options[document.form1.sel2.options.length] = new option(&quot; & _
&quot;document.form1.select1.options[document.form1.select1.selectedindex].value,&quot; & _
&quot;document.form1.select1.options[document.form1.select1.selectedindex].value);&quot;& vbcrlf
response.write &quot;<td><select id=sel2 name=sel2 size=5>&quot;
response.write &quot;</select></td>&quot;
str=str&vbcrlf&&quot;document.form1.select1.options[document.form1.select1.selectedindex]=null;&quot;&vbcrlf & _
&quot;if (document.form1.select1.options.length > 1) {&quot;&vbcrlf &#39;&_
str=str&vbcrlf & &quot;}&quot; & vbcrlf & &quot;}&quot; & vbcrlf& &quot;}&quot; & vbcrlf& &quot;}&quot; & vbcrlf
response.write &quot;<scr&quot;& &quot;ipt language=&quot;&quot;javascript&quot;&quot;>&quot; & vbcrlf
response.write str & vbcrlf & &quot;</scr&quot;&&quot;ipt>&quot;& vbcrlf

&#37;>

<&#37;
str=&quot;&quot;
str=&quot;function do_select2() {&quot; & vbcrlf & _
&quot;if (document.form1.sel2.options.length > 0) {&quot;&vbcrlf&_
&quot;var j=0;&quot;&vbcrlf&_
&quot;for(var i=0;i<document.form1.sel2.options.length;i++) {&quot;&vbcrlf & _
&quot;if(document.form1.sel2.options(i).selected) {&quot;&vbcrlf& _
&quot;j=j+1; break&quot; & vbcrlf & &quot;}&quot;&vbcrlf & &quot;}&quot;&vbcrlf& _
&quot;if (j > 0) {&quot;&vbcrlf&_
&quot;document.form1.select1.options[document.form1.select1.options.length] = new option(&quot; & _
&quot;document.form1.sel2.options[document.form1.sel2.selectedindex].value,&quot; & _
&quot;document.form1.sel2.options[document.form1.sel2.selectedindex].value);&quot;& vbcrlf
str=str&&quot;document.form1.sel2.options[document.form1.sel2.selectedindex] =null;&quot; & vbcrlf &&quot;}&quot;& vbcrlf &&quot;}&quot;& vbcrlf &&quot;}&quot;
response.write &quot;<scr&quot;& &quot;ipt language=&quot;&quot;javascript&quot;&quot;>&quot; & vbcrlf
response.write str & vbcrlf & &quot;</scr&quot;&&quot;ipt>&quot;& vbcrlf
&#37;>

</tr>
</table>
</form>
</body>
</html>

很笨吧, 哈哈!
若那位大虾有更好的方法, 可别忘了给我寄上一份哦。
e_mail: fz_chenjl@163.net


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons