.table1{background-color:white;FONT-FAMILY: Courier New, Courier;font-size:12px}
.td_out{FONT-FAMILY: Courier New, Courier;font-size:12px;color:#000000;height:15px;border:1 solid #ffffff;}
.td_over{FONT-FAMILY: Courier New, Courier;font-size:12px;cursor:default;background-color:#3366cc;border:1 solid #000000;color:#ffffff;height:15px}
.slv{vertical-align:bottom;FONT-FAMILY: Courier New, Courier;font-size:12px;border-left-width:0;border-top-width:0;border-bottom-width:0;border-right:0 solid #000000;vertical-align:middle;height:18px;color:#000000;}
.down{position:relative;left:-2px;font-size:11px;vertical-align:middle;width:16;height:16;color:#2050b0;background-color:#D0DFF7;border:1 solid #9fA3Ce;writing-mode:tb-rl;font-weight:bold;
}
.seldiv{
position:absolute;z-index:1000;overflow-x:hidden;border-left:1 solid #000000;border-bottom:1 solid #000000;border-right:1 solid #000000;
SCROLLBAR-FACE-COLOR: #d0dff7;
SCROLLBAR-HIGHLIGHT-COLOR: #d0dff7;
SCROLLBAR-SHADOW-COLOR: #FFFFFF;
SCROLLBAR-3DLIGHT-COLOR: #FFFFFF;
SCROLLBAR-ARROW-COLOR: #ffffff;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #d0dff7;}
document.οnclick=hiddenDiv;
function getDivCount() {
var arr=document.all;
re=0;
for (i=0;i
str=arr[i].id;
if (str.indexOf("ZfDiv_")==0) {
re++;
}
}
return re;
}
function getI(ObjId) {//取得objId的最后一位数字
for (i=0;i
if (ObjId.charAt(i)=="_") return ObjId.substr(i+1,ObjId.length-1);
}
return 0;
}
function select_edit(TextObj){//鼠标经过高亮度
TextObj.focus();TextObj.select();
}
function checkValue(ID){
var sl=document.all["ZfText_"+ID];
var sv=document.all["ZfDiv_"+ID];
var da=document.all["ZfData_"+ID];
sv.style.display=''
for(i=0;i
for(i=0;i
if(da.rows[i].cells[0].innerText.indexOf(sl.value)!=0)da.rows[i].style.display='none';
getPosition(ID);
}
}
function getL(e){
var l=e.offsetLeft;
while(e=e.offsetParent){
l+=e.offsetLeft;
}
return l
}
function getT(e){
var t=e.offsetTop;
while(e=e.offsetParent){
t+=e.offsetTop;
}
return t
}
function getPosition(ID){
var sv=document.all["ZfDiv_"+ID];
var sl=document.all["ZfText_"+ID];
var spn=document.all["ZfSpan_"+ID];
var da=document.getElementById("ZfData_"+ID);
sv.style.pixelWidth=spn.offsetWidth;
da.style.pixelWidth=sv.offsetWidth;
sv.style.pixelLeft=getL(spn);
sv.style.pixelTop=getT(spn)+sl.offsetHeight+3;
if(da.offsetHeight>200){
sv.style.pixelHeight=200;
sv.style.overflowY='scroll';
}
else {
sv.style.pixelHeight=da.offsetHeight;
sv.style.overflowY='hidden';
}
}
function dropDown(ID){
var sv=document.all["ZfDiv_"+ID]
var tb=document.all["ZfData_"+ID]
if(sv.style.display=='none'){
sv.style.display='';
for(i=0;i
getPosition(ID);
} else {
sv.style.display='none';
}
}//下拉摸拟层
function hiddenDiv(){
var o=window.event.srcElement.id;
var tb
var sv
if(o=="") {
for (j=0;j
tb=document.getElementById('ZfData_'+j);
sv=document.getElementById('ZfDiv_'+j);
for(i=0;i
sv.style.display='none';
}
}
}//隐藏模拟层
function setValue(obj){
var i=getI(obj.parentElement.parentElement.parentElement.id);
//alert(obj.parentElement.parentElement.parentElement.id);
var sl=document.all["ZfText_"+i];
var sv=document.all['ZfDiv_'+i];
sl.value=obj.innerText;
sv.style.display='none';
//sldIndex=obj.parentElement.rowIndex;
}//给文本框赋值
function over(obj){
obj.className="td_over"
obj.title=obj.innerText
obj.focus();
}//鼠标经过变色
function out(obj){
obj.className="td_out"
}//鼠标离开还原
function String.prototype.Trim(){return this.replace(/(^\s*)|(\s*$)/g,'')}//自定义去空格函数Trim()
//增加list的接口,ID表示该组控件是页面中的第几个
function add(v,ID){
var sv=document.all['ZfDiv_'+ID];
if(!v.Trim()){return;}
var tb=document.all['ZfData_'+ID];
var c=tb.insertRow(tb.rows.length).insertCell();
c.innerHTML=''+v.Trim()+'';
c.οnmοuseοver=new Function("over(this)");
c.οnmοuseοut=new Function("out(this)");
c.οnclick=new Function("setValue(this)");
c.className="td_out";
v='';
}
//增加inpnubox的接口,在页面中产生一个inputbox控件,下拉列表为空
function addText(name,DefValue) {
var i=getDivCount();
document.write('');
document.write('');
document.write('
}
addText("name1","a");
add("1234",0);
add("1234",0);
addText("name1","a");
add("1234",1);
add("1234",1);
.select{border: 0 inset buttonface; width: 100; font: icon; cursor: default;}
.selected{border: 0 inset buttonface; background: window; padding: 0; font: icon;}
.selectTable{height: 100%; width: 100%;border: 2 inset buttonhighlight; background: buttonface;}
.option {font: icon; padding: 1; padding-left: 3; padding-right: 3; width: 100%;}
.dropDown{position: absolute; visibility: hidden; width: 100%;border: 1 solid windowtext; padding: 0;background: window;}
.select .button {width: 16px; height: 5; font-family: webdings; padding: 0;font-size: 11px; border: 2 outset buttonhighlight;}
var overOptionCss = "background: highlight; color: highlighttext";
var sizedBorderCss = "2 inset buttonhighlight";
var globalSelect;
var ie4 = (document.all != null);
var q = 0;
function initSelectBox(el) {
copySelected(el);
var size = el.getAttribute("size");
el.options = el.children[1].children;
el.selectedIndex = findSelected(el);
el.remove = new Function("i", "int_remove(this,i)");
el.item = new Function("i", "return this.options[i]");
el.add = new Function("e", "i", "int_add(this, e, i)");
el.options[el.selectedIndex].selected = true;
dropdown = el.children[1];
if (size != null) {
if (size > 1) {
el.size = size;
dropdown.style.zIndex = 0;
initSized(el);
}
else {
el.size = 1;
dropdown.style.zIndex = 99;
if (dropdown.offsetHeight > 200) {
dropdown.style.height = "200";
dropdown.style.overflow = "auto";
}
}
}
highlightSelected(el,true);
}
function int_remove(el,i) {
if (el.options[i] != null)
el.options[i].outerHTML = "";
}
function int_add(el, e, i) {
var html = "
if (e.value != null)
html += " value='" + e.value + "'";
if (e.style.cssText != null)
html += " style='" + e.style.cssText + "'";
html += ">";
if (e.text != null)
html += e.text;
html += "
if ((i == null) || (i >= el.options.length))
i = el.options.length-1;
el.options[i].insertAdjacentHTML("AfterEnd", html);
}
function initSized(el) {
var h = 0;
el.children[0].style.display = "none";
dropdown = el.children[1];
dropdown.style.visibility = "visible";
if (dropdown.children.length > el.size) {
dropdown.style.overflow = "auto";
for (var i=0; i
h += dropdown.children[i].offsetHeight;
}
if (dropdown.style.borderWidth != null) {
dropdown.style.pixelHeight = h + 4;
}
else
dropdown.style.height = h;
}
dropdown.style.border = sizedBorderCss;
el.style.height = dropdown.style.pixelHeight;
}
function copySelected(el) {
var selectedIndex = findSelected(el);
selectedCell = el.children[0].rows[0].cells[0];
selectedDiv = el.children[1].children[selectedIndex];
selectedCell.innerHTML = selectedDiv.outerHTML;
}
function findSelected(el) {
var selected = null;
ec = el.children[1].children;
var ecl = ec.length;
for (var i=0; i
if (ec[i].getAttribute("selected") != null) {
if (selected == null) {
selected = i;
}
else
ec[i].removeAttribute("selected");
}
}
if (selected == null)
selected = 0;
return selected;
}
function toggleDropDown(el) {
if (el.size == 1) {
dropDown = el.children[1];
if (dropDown.style.visibility == "")
dropDown.style.visibility = "hidden";
if (dropDown.style.visibility == "hidden")
showDropDown(dropDown);
else
hideDropDown(dropDown);
}
}
function optionClick() {
el = getReal(window.event.srcElement, "className", "option");
if (el.className == "option") {
dropdown = el.parentElement;
selectBox = dropdown.parentElement;
oldSelected = dropdown.children[findSelected(selectBox)]
if(oldSelected != el) {
oldSelected.removeAttribute("selected");
el.setAttribute("selected", 1);
selectBox.selectedIndex = findSelected(selectBox);
}
if (selectBox.onchange != null) {
if (selectBox.id != "") {
eval(selectBox.onchange.replace(/this/g, selectBox.id));
}
else {
globalSelect = selectBox;
eval(selectBox.onchange.replace(/this/g, "globalSelect"));
}
}
if (el.backupCss != null)
el.style.cssText = el.backupCss;
copySelected(selectBox);
toggleDropDown(selectBox);
highlightSelected(selectBox, true);
}
}
function optionOver() {
var toEl = getReal(window.event.toElement, "className", "option");
var fromEl = getReal(window.event.fromElement, "className", "option");
if (toEl == fromEl) return;
var el = toEl;
if (el.className == "option") {
if (el.backupCss == null)
el.backupCss = el.style.cssText;
highlightSelected(el.parentElement.parentElement, false);
el.style.cssText = el.backupCss + "; " + overOptionCss;
this.highlighted = true;
}
}
function optionOut() {
var toEl = getReal(window.event.toElement, "className", "option");
var fromEl = getReal(window.event.fromElement, "className", "option");
if (fromEl == fromEl.parentElement.children[findSelected(fromEl.parentElement.parentElement)]) {
if (toEl == null)
return;
if (toEl.className != "option")
return;
}
if (toEl != null) {
if (toEl.className != "option") {
if (fromEl.className == "option")
highlightSelected(fromEl.parentElement.parentElement, true);
}
}
if (toEl == fromEl) return;
var el = fromEl;
if (el.className == "option") {
if (el.backupCss != null)
el.style.cssText = el.backupCss;
}
}
function highlightSelected(el,add) {
var selectedIndex = findSelected(el);
selected = el.children[1].children[selectedIndex];
if (add) {
if (selected.backupCss == null)
selected.backupCss = selected.style.cssText;
selected.style.cssText = selected.backupCss + "; " + overOptionCss;
}
else if (!add) {
if (selected.backupCss != null)
selected.style.cssText = selected.backupCss;
}
}
function hideShownDropDowns() {
var el = getReal(window.event.srcElement, "className", "select");
var spans = document.all.tags("SPAN");
var selects = new Array();
var index = 0;
for (var i=0; i
if ((spans[i].className == "select") && (spans[i] != el)) {
ropdown = spans[i].children[1];
if ((spans[i].size == 1) && (dropdown.style.visibility == "visible"))
selects[index++] = dropdown;
}
}
for (var j=0; j
hideDropDown(selects[j]);
}
}
function hideDropDown(el) {
if (typeof(fade) == "function")
fade(el, false);
else
el.style.visibility = "hidden";
}
function showDropDown(el) {
if (typeof(fade) == "function")
fade(el, true);
else if (typeof(swipe) == "function")
swipe(el, 2);
else
el.style.visibility = "visible";
}
function initSelectBoxes() {
var spans = document.all.tags("SPAN");
var selects = new Array();
var index = 0;
for (var i=0; i
if (spans[i].className == "select")
selects[index++] = spans[i];
}
for (var j=0; j
initSelectBox(selects[j]);
}
}
function getReal(el, type, value) {
temp = el;
while ((temp != null) && (temp.tagName != "BODY")) {
if (eval("temp." + type) == value) {
el = temp;
return el;
}
temp = temp.parentElement;
}
return el;
}
if (ie4) {
window.onload = initSelectBoxes;
document.onclick = hideShownDropDowns;
}
function writeSelectBox(matrix, id, size, onchange, css) {
var d = window.document;
var ie4 = (document.all != null);
if (ie4) {
//alert("Before!");
var s = createIEString(matrix, id, size, onchange, css);
document.write(s);
//alert("After!");
}else
{
document.write(createXString(matrix, id, size, onchange, css));}
}
function createIEString(matrix, id, size, onchange, css) {
var str = "";
str += '
if (size == null)
size = 1;
str += ' size="' + size + '"';
if (id != null)
str += ' id="' + id + '"';
if (onchange != null)
str += ' οnchange="' + onchange + '"';
if (css != null)
str += ' style="' + css + '"';
str += '>\n';
str += '
str += ' οnclick="toggleDropDown(this.parentElement)">\n';
str += '
\n';str += '
\n';str += '
str += ' οnmοusedοwn="this.style.border=\'2 inset buttonhighlight\'"\n';
str += ' οnmοuseup="this.style.border=\'2 outset buttonhighlight\'">\n';
str += '6
\n';str += '
\n';str += '
\n';str += '
for (var i=0; i
html = matrix[i].html;
value = matrix[i].value;
css = matrix[i].css;
selected = matrix[i].selected;
str += '
if (value != null)
str += ' value="' + value + '"';
if (css != null)
str += ' style="' + css + '"';
if (selected != null)
str += ' selected';
str += '>\n';
str += html;
str += '
}
str += '
str += '\n';
return str;
}
function createXString(matrix, id, size, onchange, css) {
var str = '
\n';str += '
if (size == null)
size = 1;
str += ' size="' + size + '"';
if (id != null)
str += ' id="' + id + '"';
if (onchange != null)
str += ' οnchange="' + onchange + '"';
str += '>\n';
for (var i=0; i
html = matrix[i].html;
value = matrix[i].value;
css = matrix[i].css;
selected = matrix[i].selected;
str += '\n
if (value != null)
str += ' value="' + value + '"';
if (selected != null)
str += ' selected';
str += '>';
str += stripTags(html);
str += '
\n';}
str += '\n
\n';str += '\n';
return str;
}
function stripTags(str) {
var s = 0;
var e = -1;
var r = "";
s = str.indexOf("
do {
r += str.substring(e + 1,s);
e = str.indexOf(">",s);
s = str.indexOf("
}
while ((s != -1) && (e != -1))
r += str.substring(e + 1,str.length);
return r;
}
function Option(html, value, css, selected) {
this.html = html;
this.value = value;
this.css = css;
this.selected = selected;
}
var optionArray = new Array();
optionArray[0] = new Option("Item 1", "value 1", "color: blue; text-decoration: underline;");
optionArray[1] = new Option("Item 2", "value 2");
optionArray[2] = new Option("Item 3", "value 3", "color: red;", "selected");
optionArray[3] = new Option("Item 4", "value 4");
optionArray[4] = new Option("Item 5", "value 5");
writeSelectBox(optionArray, "select1", 1, "alert(this.options[this.selectedIndex].value)", "margin-left: 10;");
writeSelectBox(optionArray, "select3", 3, "alert(this.options[this.selectedIndex].value)", "margin-left: 10;");
BODY {
SCROLLBAR-FACE-COLOR: #d80000;
SCROLLBAR-HIGHLIGHT-COLOR: #0000fc;
SCROLLBAR-SHADOW-COLOR: #24fc90;
SCROLLBAR-ARROW-COLOR: #fcfc48;
SCROLLBAR-TRACK-COLOR: #002400;
SCROLLBAR-DARKSHADOW-COLOR: #00b448;
SCROLLBAR-BASE-COLOR: #fc0000
}
function turnit(ss)
{
if (ss.style.display=="none")
{ss.style.display="";
}
else
{ss.style.display="none";
}
}
function sele(tid)
{
bb.style.display='none';
text1.value=tid.innerText;
}
function over(tid)
{
for (var i=1;i<4;i++)
{
eval('t'+i).className=''
}
tid.className='ss'
}
function out(tid)
{
if (bb.style.display!='none')
tid.className=''
}
|