JavaScript模态窗口

function showUsers(){
 var url = "*.htm";
 var usersData =  window.showModalDialog(url,"","dialogWidth:800px;dialogHeight:400px;status:'no'");
 var arr = usersData.split("|");
 if(arr != null)
  {
  document.workOrderForm.userIds.value = arr[0];
  document.workOrderForm.userName.value = arr[1];
  }
}

*.htm代码
function doSubmit(){
var resultIds = "";
var resultNames = "";
var options = document.selectForm.selectUsers.options;
for(var i=0;i<options.length;i++){
if (options[i].selected == true){
resultIds = resultIds + options[i].value + ",";
resultNames = resultNames + options[i].text + ",";
}
}
if (resultIds ==""){
alert("您没有选择!");
return;
}
window.returnValue = resultIds+ "|" + resultNames; //将select的值返回给页面
window.close()
}

你可能感兴趣的:(JavaScript)