急!请帮忙! 它显示的错误是'dd[..].length'为空或不是对象,这是怎么回事呢,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><link rel=stylesheet href="style.css" type="text/css"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel=stylesheet href="style.css" type="text/css"><title>Call Forwarding</title></head><body><form name="form1" method="post"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="80%"><table width="457" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="34" align="left" class="style2"></td> </tr> <tr> <td align="left" class="style1"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td height="20" colspan="2" valign="middle" bgcolor="#FFFFFF" align="center" class="t_one"></td> </tr> <tr> <td height="20" colspan="2" valign="middle" bgcolor="#FFFFFF" align="left">></td> </tr> <tr> <td height="20" colspan="2" align="left" valign="middle" bgcolor="#FFFFFF"> <input type="text" id="ID" name="p_callerid" size="32" maxlength="32" value="$$p_callerid$$"></td></tr><tr> <td width="210" height="20" align="center" valign="middle" bgcolor="#FFFFFF"></td> <td width="241" height="20"align="center" valign="middle" bgcolor="#FFFFFF"> <input type="hidden" name="P_Callerid" value="$$P_Callerid$$"> <input type="hidden" name="P_Callerid1" value="$$P_Callerid1$$"> <input type="hidden" name="P_Callerid2" value="$$P_Callerid2$$"> <input type="hidden" name="P_Callerid3" value="$$P_Callerid3$$"> <input type="hidden" name="P_Callerid4" value="$$P_Callerid4$$"> <input type="hidden" name="P_Callerid5" value="$$P_Callerid5$$"> <input type="hidden" name="P_Callerid6" value="$$P_Callerid6$$"> <input type="hidden" name="P_Callerid7" value="$$P_Callerid7$$"> <input type="hidden" name="P_Callerid8" value="$$P_Callerid8$$"> <input type="hidden" name="P_Callerid9" value="$$P_Callerid9$$"> <input type="hidden" name="idlist" value="$$idlist$$"> <select name="CIDL" id="cidl" size="15"> <option value="CallerIDList"> </option> </select> </td></tr> </table></td></tr><tr> <td height="20" align="right" valign="middle" bgcolor="#FFFFFF"> <input type="button" name="add" value="Add" onclick="onadd()"> <input type="button" name="delete" value="Delete" onclick="ondelete()"> <input type="button" name="clear" value="Clear All" onclick="onclearall()"> <input type="button" name="apply" value="Apply" onclick="onapply()"></td> </tr> </table></form><script language="javascript">for(var s=0;s<10;s++){document.form1.idlist.value=document.form1.idlist.value+document.form1.elements[s+7].value;} num=document.form1.idlist.value.split(","); for(var k=1;k<(num.length);k++) { var option =document.createElement("OPTION"); option.value=num[k]; option.text=num[k]; var nums = document.form1.CIDL.options.length; document.form1.CIDL.options[nums]=option; }function onadd(){ var sel1 = document.form1.p_callerid.value; var sel2 = document.form1.CIDL; var option =document.createElement("OPTION"); option.value=sel1; option.text=sel1; var items = sel2.options.length; sel2.options[items]=option; document.form1.CIDL[items].value=option.value; document.form1.CIDL[items].text=option.text; document.form1.idlist.value=document.form1.idlist.value+','+document.form1.ID.value; document.form1.p_callerid.value="";}function ondelete(){ var num = document.form1.CIDL.selectedIndex; if (num>0) document.form1.CIDL.options[num] = null; else document.form1.CIDL.selectedIndex = 10000; dd=document.form1.idlist.value.split(","); ddstring=""; for(var j=1;j<(num);j++) { ddstring=ddstring+','+dd[j]; } for(var k=(num+1);k<(dd.length);k++) { ddstring=ddstring+','+dd[k]; } document.form1.idlist.value=ddstring;}function onclearall(){allid=document.form1.CIDL.options.length;for(var i=(allid-1);i>0;i--){document.form1.CIDL.options[i] = null;}document.form1.idlist.value="";}function onapply() { document.form1.elements[7].value=""; document.form1.elements[8].value=""; document.form1.elements[9].value=""; document.form1.elements[10].value=""; document.form1.elements[11].value=""; document.form1.elements[12].value=""; document.form1.elements[13].value=""; document.form1.elements[14].value=""; document.form1.elements[15].value=""; var ALL_num = document.form1.CIDL.selectedIndex; dd=document.form1.idlist.value.split(","); num=0; num1=0; for(var i=0;i<10;i++){ num=num+num1; for(var j=num;j<(ALL_num);j++) { num1=0; num1=num1+dd[j].length; if((num1*32+num1)>99) return num1; } for(var k=num+1;k<(num1);k++) { document.form1.elements[i+7].value=document.form1.elements[i+7].value +','+dd[k] ; }} document.form1.idlist.value="";document.form1.submit();} 就是提错误误是'dd[..].length'为空或不是对象,不能提交,^_^ 你可以用alert(typeof dd[i]);查看dd[i]是什么,或者alert(dd[i]);看一下值是什么 我试过了,它弹出的警告框为 undefined ,到底错在哪里呢,^_^ 试试 for(var j=1;j<(num) && j<(dd.length);j++) { ddstring=ddstring+','+dd[j]; } for(var k=(num+1);k<(dd.length);k++) { ddstring=ddstring+','+dd[k]; } 为什么这样定义数组for ..in遍历就不执行 JS web打印遇到的难题! 关于jquery ajax里面回调函数 学习javascript中open窗口操作方法 很怪异的问题,window.close失效了,怎么解决 关闭窗口触发的事件是啥 请给个能用鼠标拖动元素的例子吧 有没有办法用js在页面上画一条任意角度的直线? 请问如何取出<tr>或<td>中的文本元素,而不要其他信息 js的运算问题?(费解,急!) 用document.write写script标记无效 正则表达式如何匹配多行
<head>
<link rel=stylesheet href="style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel=stylesheet href="style.css" type="text/css">
<title>Call Forwarding</title>
</head>
<body>
<form name="form1" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80%"><table width="457" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="34" align="left" class="style2"></td>
</tr>
<tr>
<td align="left" class="style1"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="20" colspan="2" valign="middle" bgcolor="#FFFFFF" align="center" class="t_one"></td>
</tr>
<tr>
<td height="20" colspan="2" valign="middle" bgcolor="#FFFFFF" align="left">></td>
</tr> <tr>
<td height="20" colspan="2" align="left" valign="middle" bgcolor="#FFFFFF"> <input type="text" id="ID" name="p_callerid" size="32" maxlength="32" value="$$p_callerid$$"></td>
</tr>
<tr>
<td width="210" height="20" align="center" valign="middle" bgcolor="#FFFFFF"></td>
<td width="241" height="20"align="center" valign="middle" bgcolor="#FFFFFF">
<input type="hidden" name="P_Callerid" value="$$P_Callerid$$">
<input type="hidden" name="P_Callerid1" value="$$P_Callerid1$$">
<input type="hidden" name="P_Callerid2" value="$$P_Callerid2$$">
<input type="hidden" name="P_Callerid3" value="$$P_Callerid3$$">
<input type="hidden" name="P_Callerid4" value="$$P_Callerid4$$">
<input type="hidden" name="P_Callerid5" value="$$P_Callerid5$$">
<input type="hidden" name="P_Callerid6" value="$$P_Callerid6$$">
<input type="hidden" name="P_Callerid7" value="$$P_Callerid7$$">
<input type="hidden" name="P_Callerid8" value="$$P_Callerid8$$">
<input type="hidden" name="P_Callerid9" value="$$P_Callerid9$$"> <input type="hidden" name="idlist" value="$$idlist$$">
<select name="CIDL" id="cidl" size="15">
<option value="CallerIDList"> </option>
</select>
</td></tr>
</table></td></tr>
<tr>
<td height="20" align="right" valign="middle" bgcolor="#FFFFFF">
<input type="button" name="add" value="Add" onclick="onadd()">
<input type="button" name="delete" value="Delete" onclick="ondelete()">
<input type="button" name="clear" value="Clear All" onclick="onclearall()">
<input type="button" name="apply" value="Apply" onclick="onapply()">
</td>
</tr>
</table>
</form>
<script language="javascript">
for(var s=0;s<10;s++)
{
document.form1.idlist.value=document.form1.idlist.value+document.form1.elements[s+7].value;
}
num=document.form1.idlist.value.split(",");
for(var k=1;k<(num.length);k++)
{
var option =document.createElement("OPTION");
option.value=num[k];
option.text=num[k];
var nums = document.form1.CIDL.options.length;
document.form1.CIDL.options[nums]=option;
}
function onadd(){ var sel1 = document.form1.p_callerid.value;
var sel2 = document.form1.CIDL;
var option =document.createElement("OPTION");
option.value=sel1;
option.text=sel1;
var items = sel2.options.length;
sel2.options[items]=option;
document.form1.CIDL[items].value=option.value;
document.form1.CIDL[items].text=option.text;
document.form1.idlist.value=document.form1.idlist.value+','+document.form1.ID.value;
document.form1.p_callerid.value="";
}
function ondelete(){
var num = document.form1.CIDL.selectedIndex;
if (num>0)
document.form1.CIDL.options[num] = null;
else
document.form1.CIDL.selectedIndex = 10000;
dd=document.form1.idlist.value.split(",");
ddstring="";
for(var j=1;j<(num);j++)
{
ddstring=ddstring+','+dd[j];
}
for(var k=(num+1);k<(dd.length);k++)
{
ddstring=ddstring+','+dd[k];
}
document.form1.idlist.value=ddstring;
}
function onclearall(){
allid=document.form1.CIDL.options.length;
for(var i=(allid-1);i>0;i--){
document.form1.CIDL.options[i] = null;
}
document.form1.idlist.value="";
}
function onapply() {
document.form1.elements[7].value="";
document.form1.elements[8].value="";
document.form1.elements[9].value="";
document.form1.elements[10].value="";
document.form1.elements[11].value="";
document.form1.elements[12].value="";
document.form1.elements[13].value="";
document.form1.elements[14].value="";
document.form1.elements[15].value="";
var ALL_num = document.form1.CIDL.selectedIndex;
dd=document.form1.idlist.value.split(",");
num=0;
num1=0;
for(var i=0;i<10;i++)
{
num=num+num1;
for(var j=num;j<(ALL_num);j++)
{
num1=0;
num1=num1+dd[j].length;
if((num1*32+num1)>99)
return num1;
}
for(var k=num+1;k<(num1);k++)
{
document.form1.elements[i+7].value=document.form1.elements[i+7].value +','+dd[k] ;
}
}
document.form1.idlist.value="";
document.form1.submit();
}
for(var j=1;j<(num) && j<(dd.length);j++)
{
ddstring=ddstring+','+dd[j];
}
for(var k=(num+1);k<(dd.length);k++)
{
ddstring=ddstring+','+dd[k];
}