87,996
社区成员




mynewcell = mynewrow.insertCell();
mynewcell.innerHTML="<input type='text' name='WarehoseNameList' size='20' ondblclick='change_ware_input(this)' readonly value="+ wareName +" style='border: 0 solid #A6CAF0; background-color: #A6CAF0'>";
在javascript中change_ware_input这样写:
var warehouse="<SELECT name='SelectWarehoseNameList' onblur='change_ware_table(this)'>";
...
obj.parentElement.innerHTML=""+warehouse+"</SELECT>";
在change_ware_table方法:
obj.parentElement.innerHTML="<input type='text' name='WarehoseNameList' size='20' ondblclick='change_ware_input(this)' readonly value="+ obj.options[obj.selectedIndex].text +" style='border: 0 solid #A6CAF0; background-color: #A6CAF0'>";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
$ = function(id) { return document.getElementById(id); }
function display(visible) {
$("text").style.display = visible ? "inline" : "none";
$("select").style.display = !visible ? "inline" : "none";
}
function focusOut() {
$("text").value = $("select").value;
display(true);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" id="text" ondblclick="display(false);" />
<select id="select" style="display: none;" onblur="focusOut();">
<option value="0">your testing 0</option>
<option value="1">your testing 1</option>
<option value="2">your testing 2</option>
</select>
</div>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
document.onclick = function() {
var event = window.event || arguments.callee.caller.arguments[0];
if (event.srcElement) {
// if (event.srcElement.id == "text") display(false);
// else
if (event.srcElement.id == "select") return;
else display(true);
}
}
function display(visible) {
$ = function(id) { return document.getElementById(id); }
$("text").style.display = visible ? "inline" : "none";
$("select").style.display = !visible ? "inline" : "none";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type=text id="text" ondblclick="display(false);" />
<select id="select" style=" display: none;" >
<option value="0">your testing</option>
</select>
</div>
</form>
</body>
</html>