js 对象不支持此属性或方法 js运行到这一步 opener.selectCust(selectText,selectValue);报错,但是我已经定义了function selectCust() {}为什么啊,始终找不出原因 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function selectCustOk(){ var selectedcust = document.getElementById('selectedcust'); var selectText = ""; var selectValue = ""; for(var i=0; i<selectedcust.options.length; i++){ var temp = selectedcust.options[i].text.split('|'); if(selectText == ""){ selectText = temp[1];//selectedcust.options[i].text; } else { selectText = selectText + "," + temp[1];//selectedcust.options[i].text; } if(selectValue == ""){ selectValue = selectedcust.options[i].value; } else { selectValue = selectValue + "," + selectedcust.options[i].value; } } opener.selectCust(selectText,selectValue); window.close(); }function unSelectCust(){ var unselectedcust = document.getElementById('unselectedcust'); if(!unselectedcust){ var htmlStr = '<select name="unselectedcust" multiple="multiple" style="width: 100%" size="20" ondblclick="dbClick(this);"></select>'; var norecd = document.getElementById("norecd"); norecd.innerHTML = htmlStr; unselectedcust = document.getElementById('unselectedcust'); } var selectedcust = document.getElementById('selectedcust'); if(selectedcust.selectedIndex == -1){ return; } for(var i=0; i<selectedcust.options.length; i++){ var selectText = selectedcust.options[i].text; var selectValue = selectedcust.options[i].value; if(selectValue==""){ selectedcust.options[i].selected = false; continue; } if(selectedcust.options[i].selected){ var length = unselectedcust.options.length; unselectedcust.options.add(new Option(selectText,selectValue)); unselectedcust.options[length].selected = true; selectedcust.options.remove(i--); } } } function selectCust() { var unselectedcust = document.getElementById('unselectedcust'); var selectedcust = document.getElementById('selectedcust'); if(unselectedcust.selectedIndex == -1){ return; } for(var i=0; i<unselectedcust.options.length; i++){ var selectText = unselectedcust.options[i].text; var selectValue = unselectedcust.options[i].value; if(selectValue==""){ unselectedcust.options[i].selected = false; continue; } if(unselectedcust.options[i].selected){ //判断是否存在 for(var j=0; j<selectedcust.options.length;j++){ var exsitValue = selectedcust.options[j].value; if(selectValue == exsitValue) { return false; } } var length = selectedcust.options.length; selectedcust.options.add(new Option(selectText,selectValue)); selectedcust.options[length].selected = true; unselectedcust.options.remove(i--); } } } 恩,是可以。为啥不直接调用,而用opener.呢,这个好像不行。 opener是个啥东西?selectCust方法是你单独定义的,相当于一个静态方法,并不属于任何一个对象的propertype,要是要这样写,先这样opener.selectCust=function(){...}然后再这么调用 命名改一下:function selectCust() {}---》function ChooseCust() {} servlet疑问 如何判断hibernate持久化是否成功 前辈请进 hibernate2升级到hibernate3的报错问题 急。。。 Spring AOP问题,能否配置两个BeanNameAutoProxyCreator 这个东东?谢谢 帮忙看看我的Hibernate代码为什么不运行????? 关于通讯录的问题 关于ibatis的查询速度! 急!急!急! 如何保存xml的部分结点? java.lang.IllegalArgumentException java将数据库datetime类型的转换问题 方法签名
var selectedcust = document.getElementById('selectedcust');
var selectText = "";
var selectValue = "";
for(var i=0; i<selectedcust.options.length; i++){
var temp = selectedcust.options[i].text.split('|');
if(selectText == ""){
selectText = temp[1];//selectedcust.options[i].text;
} else {
selectText = selectText + "," + temp[1];//selectedcust.options[i].text;
}
if(selectValue == ""){
selectValue = selectedcust.options[i].value;
} else {
selectValue = selectValue + "," + selectedcust.options[i].value;
}
}
opener.selectCust(selectText,selectValue);
window.close();
}function unSelectCust(){
var unselectedcust = document.getElementById('unselectedcust');
if(!unselectedcust){
var htmlStr = '<select name="unselectedcust" multiple="multiple" style="width: 100%" size="20" ondblclick="dbClick(this);"></select>';
var norecd = document.getElementById("norecd");
norecd.innerHTML = htmlStr;
unselectedcust = document.getElementById('unselectedcust');
}
var selectedcust = document.getElementById('selectedcust');
if(selectedcust.selectedIndex == -1){
return;
}
for(var i=0; i<selectedcust.options.length; i++){
var selectText = selectedcust.options[i].text;
var selectValue = selectedcust.options[i].value; if(selectValue==""){
selectedcust.options[i].selected = false;
continue;
}
if(selectedcust.options[i].selected){
var length = unselectedcust.options.length;
unselectedcust.options.add(new Option(selectText,selectValue));
unselectedcust.options[length].selected = true;
selectedcust.options.remove(i--);
}
}
}
function selectCust() {
var unselectedcust = document.getElementById('unselectedcust');
var selectedcust = document.getElementById('selectedcust');
if(unselectedcust.selectedIndex == -1){
return;
}
for(var i=0; i<unselectedcust.options.length; i++){
var selectText = unselectedcust.options[i].text;
var selectValue = unselectedcust.options[i].value;
if(selectValue==""){
unselectedcust.options[i].selected = false;
continue;
}
if(unselectedcust.options[i].selected){
//判断是否存在
for(var j=0; j<selectedcust.options.length;j++){
var exsitValue = selectedcust.options[j].value;
if(selectValue == exsitValue) {
return false;
}
}
var length = selectedcust.options.length;
selectedcust.options.add(new Option(selectText,selectValue));
selectedcust.options[length].selected = true;
unselectedcust.options.remove(i--);
}
}
}
为啥不直接调用,而用opener.呢,这个好像不行。
opener.selectCust=function(){...}然后再这么调用