常用JS中自定義函數及方法

 

//打開一個模式對和話框 
function openwin() 
// 使窗口居中 
var iWidth = 500//模態窗口寬度 
var iHeight = 350//模態窗口高度 
var iTop = (window.screen.height - iHeight) / 2
var iLeft = (window.screen.width - iWidth) / 2
window.open(
"../../selectcompany.aspx""機構選擇對話框""height=" + iHeight + ", width=" + iWidth + ", top=" + iTop + ", left=" + iLeft + ", toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no"); 
}

// 刪除下拉列表框中所有元素
for (i = document.all.DDList_value.options.length; i >= 0; i--)
    document.all.DDList_value.options.remove(i);
 
//顯示下拉列表框DDList_value,並將下拉框 DList_department的選項全部複製到DDList_value中
document.all.DDList_value.style.display = "";
var sou=document.all.DList_department;
for(var i=0;i<sou.options.length;i++)
 
{
    
var newOption = document.createElement("OPTION");
 newOption.text 
= sou.options[i].text;
 document.all.DDList_value.options.add(newOption);
 }

 

//控制控件 的可見度及可見性
document.getElementById("main").style.filter="Alpha(Opacity=70)";
document.getElementById(
"main").disabled = true;
document.getElementById(
"div_panel").style.display = "";      
document.getElementById(
"div_add").style.display = "none";

 

 

//以下一點注意:!!!!!
//
當在客戶端用JS控件下拉列表DDList_value的選項後,在服務器端就不能用this.DDList_value.SelectedItem.Text得到數據
//
只能用下面的方法得到下拉框中選擇的項的值

sValue 
= Request.Form["DDList_value"].ToString(); //this.DDList_value.SelectedItem.Text;這樣得不到數據!!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章