作者gpgpt (陌生)
看板Web_Design
标题[问题] 多个下拉选单并存
时间Sat May 10 07:10:30 2008
想请教如何在一个页面当中出现多个下拉式选单?
我目前是这样写:(没有用到资料库,只有连到该网页)
<form id="form1" name="form1" method="post" action="">
<script language="JavaScript">
<!--
function surfto(form)
{var myindex=form.
select1.selectedIndex;
window.open(form.
select1.options[myindex].value,'_self','');}
//-->
function showInfo(obj)
{alert(obj[obj.selectedIndex].getAttribute("text"));}
</script>
<select name="
select1" id="form"
onchange="document.getElementById('ft1').
innerHTML=''+this[this.selectedIndex].title;">
<option value="000.html"
title="000" selected="selected">000</option>
<option value="111.html"
title="111">111</option>
<option value="222.html"
title="222">222</option>
</select>
<input type="button" value="GO" onClick="surfto(this.form)"/></form>
<span id="ft1"></span>
可是只要复制第二个,就会打架,其中一个无法使用,
就算改变select1为select2也没有办法,
想请问还有哪边需要改?
还有一个问题是,我要让他选择後(还没按GO)先显示title的值,
这部份是已经ok的,但一进入网页时,他并不会先出现预设(000)的title,
必须先选到111、222...才会出现,
不知道该怎麽修改,让他直接先出现selected的title?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.165.163.104