2007-03-24

 

一览画面控制用JS代码


代码:

var ie = (document.all && typeof(ActiveXObject) != "undefined");
var _className = ie ? "className" : "class";

function showHide(objID)
{
var obj = document.getElementById(objID);
if (obj)
{
obj.style.display = obj.style.display=="none" ? "" : "none";
}
}

function clearInput(objID)
{
if (!confirm("Are you sure?"))
{
return;
}
var obj = document.getElementById(objID);
if (obj)
{
var inputList = obj.getElementsByTagName("INPUT");
if (inputList)
{
for(var i=0; i
{
if (inputList[i].getAttribute("TYPE")=="text")
{
inputList[i].value = "";
}
}
}
}
}

function selectCheckbox(tableID, value)
{
var table = document.getElementById(tableID);
if (table)
{
var inputList = table.getElementsByTagName("INPUT");
if (inputList)
{
for(var i=0; i
{
if (inputList[i].getAttribute("TYPE")=="checkbox")
{
if (inputList[i].checked != value)
{
inputList[i].checked = value;
checkboxClick(inputList[i]);
}
}
}
}
}
}

function deleteConfirm(tableID)
{
var isSelected = false;
var table = document.getElementById(tableID);
if (table)
{
var inputList = table.getElementsByTagName("INPUT");
if (inputList)
{
for(var i=0; i
{
if (inputList[i].getAttribute("TYPE")=="checkbox")
{
if (inputList[i].checked)
{
isSelected = true;
break;
}
}
}
}
}

if (isSelected)
{
return confirm("Are you sure?\r\nThat will delete all the selected rows.");
}
else
{
alert("No rows selected.");
return false;
}
}

function checkboxClick(checkbox)
{
var tr = checkbox.parentNode.parentNode;
if (checkbox.checked)
{
checkbox.setAttribute("prevclass", tr.getAttribute(_className));
tr.setAttribute(_className, "Checked");
}
else
{
tr.setAttribute(_className, checkbox.getAttribute("prevclass"));
}
}

Labels:


Comments: Post a Comment





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]

/**/