关于字符串的问题,请DX指教,谢谢!! if (s1.search(s2)!==-1) // !== ?if (s1.search(s2)!=-1) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 试一试<script language="javascript"><!--function checkupform(){for (var i=0;i<document.test.myselect.options.length;i++)if (document.test.myselect.options[i].selected){s1=document.test.mytext.value.tostring();s2=document.test.myselect.options[i].value.tostring();if (s1.search(s2)!==-1){window.alert("该项已存在!");}}--></script> 帮你测试通过了。<form name="test"><input type="text" name="mytext" value="abcdefg"><select name="myselect" onchange="checkupform();"><option value="abc">abc</option><option value="def">def</option><option value="ghi">ghi</option></select></form><script language="javascript"><!--function checkupform(){ for (var i=0;i<test.myselect.options.length;i++) if (test.myselect.options[i].selected) { var s1=document.test.mytext.value; var s2=document.test.myselect.value; if (s1.search(s2)!=-1) { window.alert("该项已存在!"); } }}--></script> JQuery鼠标停留时间设置 求助:cookie太小怎么办,大家是怎么解决的啊? 怎么用js改变select的 请教一个JAVASCRIPT自动计算问题,请指教!谢谢,,急等.......... 兄弟们,关于引号的问题,折磨死了,高手请进. 关于取单元格背景颜色的问题~~~~~~~~ 帮帮忙,看看这个选择问题出在哪了? 我叙述不清楚,请高手进来看看我的代码和问题吧!!!急 特殊 请问在javascript中new Option(str, str1)的详细用法, 请问怎么用JavaScript删除文件? 求助....在javascript中如何判断某个单选按扭是否被选中
<script language="javascript">
<!--
function checkupform()
{
for (var i=0;i<document.test.myselect.options.length;i++)
if (document.test.myselect.options[i].selected)
{
s1=document.test.mytext.value.tostring();
s2=document.test.myselect.options[i].value.tostring();
if (s1.search(s2)!==-1)
{
window.alert("该项已存在!");
}
}
-->
</script>
<form name="test">
<input type="text" name="mytext" value="abcdefg">
<select name="myselect" onchange="checkupform();">
<option value="abc">abc</option>
<option value="def">def</option>
<option value="ghi">ghi</option>
</select>
</form>
<script language="javascript">
<!--
function checkupform()
{
for (var i=0;i<test.myselect.options.length;i++)
if (test.myselect.options[i].selected)
{
var s1=document.test.mytext.value;
var s2=document.test.myselect.value;
if (s1.search(s2)!=-1)
{
window.alert("该项已存在!");
}
}
}
-->
</script>