惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
S
SegmentFault 最新的问题
云风的 BLOG
云风的 BLOG
T
Tailwind CSS Blog
博客园 - 聂微东
小众软件
小众软件
J
Java Code Geeks
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
量子位
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
M
MIT News - Artificial intelligence
Apple Machine Learning Research
Apple Machine Learning Research
有赞技术团队
有赞技术团队
月光博客
月光博客
B
Blog RSS Feed
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cyberwarzone
Cyberwarzone
I
Intezer
The Register - Security
The Register - Security
博客园 - 【当耐特】
博客园 - 司徒正美
L
Lohrmann on Cybersecurity
U
Unit 42
N
News and Events Feed by Topic
S
Security Affairs
V
Visual Studio Blog
Y
Y Combinator Blog
Security Latest
Security Latest
Know Your Adversary
Know Your Adversary
Google DeepMind News
Google DeepMind News
大猫的无限游戏
大猫的无限游戏
S
Schneier on Security
P
Privacy International News Feed
TaoSecurity Blog
TaoSecurity Blog
Spread Privacy
Spread Privacy
G
Google Developers Blog
NISL@THU
NISL@THU
Project Zero
Project Zero
P
Palo Alto Networks Blog
Help Net Security
Help Net Security
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
S
Security @ Cisco Blogs
G
GRAHAM CLULEY
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - kenly33

ORM及代码生成器和插件C#源码(最新版Kenly.DBFramework4.5.8.5) 處理RadioButtonList客戶端事件 - kenly33 - 博客园 对象关系映射架构(DBFramework)及代码生成器和插件(源码) 使對象支持自定義比較 統計分數 讀寫XML文檔 - kenly33 - 博客园 Visual Studio Team System简介 过滤某些字段重复的记录 MultiFileUploador GridViewNavigator Gridview梆定 兩個輸入框只允許一個輸入 Gridview中梆定得RadioButton Javascript 隱藏或顯示某區域 ASP.NET 2.0中合并 GridView 的表头单元格 VS2005 RESOURCE MANAGEMENT 鲸鱼哲学 FxCop Rules Atlas使用演练
Javascript彈出對話框
kenly33 · 2006-11-29 · via 博客园 - kenly33

 // 用於彈出對話框,並從分部門(組織)中選擇用戶,可多選
// url: 彈出對話框的頁面的路徑,可以是相對路徑。
// height: 彈出模式對話框的高度。
// width: 彈出對話框的寬度。
// objList: 存放選擇用戶的列表框
// objComment: 放置說明文字的DIV


function ShowModalDialog(url,height,width,filledListBoxId,dataContainerId,buttonId)
{
 var oPara;
 var returnData = window.showModalDialog(url,oPara,"dialogHeight:"+height+"px; dialogWidth:"+width+"px; center: Yes; help: No; resizable: No; status: no;");
 
 if(returnData != null && returnData != "")
 {
  var listBox = document.getElementById(filledListBoxId);
  var dataContainer = document.getElementById(dataContainerId);
  var button = document.all.item(buttonId);
  
  listBox.style.display="block";
  
  var items = returnData.split("||");
  
  for(var i=0;i<items.length;i++)
  {
   var itemInfo = items[i];
   var textAndValue = itemInfo.split("|");
   
   //判斷該item是否已經存在于列表框
   var flag = false;
   for(var j=0;j<listBox.options.length;j++)
   {
    if(listBox.options[j].value == textAndValue[1])
    {
     flag = true;
     break;
    }
   }
   if(!flag)
   {
    var newOption = new Option(textAndValue[0],textAndValue[1]);
    listBox.options[listBox.options.length]=newOption;
    
    if(dataContainer.value == null || dataContainer.value == "")
    {
     dataContainer.value = textAndValue[0]+"|"+textAndValue[1];
    }
    else
    {
     dataContainer.value += "||" +textAndValue[0]+"|"+textAndValue[1];
    }
   }
  } 
   
  button.click();
  
 }
}

function AddAllItems(sourceListBox,targetListBox)
{
 for(var i=0;i<sourceListBox.options.length;i++)
 {
  var item = sourceListBox.options[i];
  if(!ContainItem(targetListBox,item.value))
   {
    targetListBox[targetListBox.length]=new Option(item.text,item.value);
   }
 }
}

function AddSelectedItems(sourceListBox,targetListBox)
{
 for(var i=0;i<sourceListBox.options.length;i++)
 {
  var item = sourceListBox.options[i];
  if(item.selected)
  {
   if(!ContainItem(targetListBox,item.value))
   {
    targetListBox[targetListBox.length]=new Option(item.text,item.value);
   }
  }
 }
}

function ContainItem(targetListBox,value)
{
    var exists = false;
 for(var j=0;j<targetListBox.options.length;j++)
 {
  if(value == targetListBox.options[j].value)
  {
   exists = true;
   return exists;
  }
 }
 return exists;
}

function RemoveSelectedItems(targetListBox)
{
 for(var i=targetListBox.options.length-1;i>=0;i--)
 {
  var item = targetListBox.options[i];
  if(item.selected)
  {
   targetListBox.options.remove(i);
  }
 }
}

function RemoveAllItems(targetListBox)
{
 for(var i=targetListBox.options.length-1;i>=0;i--)
 {
  var item = targetListBox.options[i];
  targetListBox.options.remove(i);
 }
}

function MoveDownSelectedItem(listBox)
{
 for(var i=0;i<listBox.options.length-1;i++)
 {
  var item = listBox.options[i];
  if(item.selected)
  {
   var value=item.value;
      var text=item.text;
      item.value=listBox.options[i+1].value;
      item.text=listBox.options[i+1].text;
      listBox.options[i+1].value=value;
      listBox.options[i+1].text=text;
      item.selected=false;
      listBox.options[i+1].selected=true;
      break;
  }
 }
}

function MoveUpSelectedItem(listBox)
{
 for(var i=0;i<listBox.options.length;i++)
 {
  var item = listBox.options[i];
  if(item.selected && i>0)
  {
   var value=item.value;
      var text=item.text;
      item.value=listBox.options[i-1].value;
      item.text=listBox.options[i-1].text;
      listBox.options[i-1].value=value;
      listBox.options[i-1].text=text;
      item.selected=false;
      listBox.options[i-1].selected=true;
      break;
  }
 }
}

function ReturnWindowsData(targetListBox)
{
 var ret = "";
 
 for(var i=0;i<targetListBox.options.length;i++)
 {
   ret+= targetListBox.options[i].value+"|"+targetListBox.options[i].text+"||";
 }
 if(ret.length == 0)
 {
  alert("No item has been selected!");
 }
 else
 {
  ret = ret.substr(0,ret.length-2);
  window.returnValue = ret;
  window.opener = null;
  window.close();
 }
}

function Cancel()
{
 window.returnValue = null;
 window.opener = null;
 window.close();
}