某大型软件公司JavaScript考题,紧急求助! 这个简单di说 怕不是大型软件公司哦----------up 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用这中语法document.getElementById("ID").innerHTML回填到父窗口中 document.getElementById("ID").innerHTML = value;(javascript) 随手写了一个, 你自己再发挥一下:<table border=1 width=400> <tr> <td>姓名</td> <td>数学</td> <td>历史</td> <td>外语</td> <td>总分</td> <td><input type=button value="关闭窗口" onclick="opener='meizz';close()"></td> </tr> <tr> <td>张三</td> <td>78</td> <td>92</td> <td>85</td> <td>255</td> <td><input type=button value="修改成绩" onclick="mm(this)"></td> </tr></table><div id=mmDiv style="position: absolute; z-index: 1; width: 240;border: 1px solid block; display: none; background-color: yellow"><form name=mmhide style="margin: 0">数学: <input name=sx><br>历史: <input name=ls><br>外语: <input name=wy><br><input type=button value="修改数据"><input type=button value="关闭窗口" onclick="closeLayer()"></form></div><SCRIPT LANGUAGE="JavaScript"><!--function searchObjByTagName(obj, tag){ while(obj!=null && typeof(obj.tagName) != "undefind") { if(obj.tagName == tag.toUpperCase()) return(obj); obj = obj.parentElement; } return null;}function getAbsLeft(e){var l=e.offsetLeft; while(e=e.offsetParent) l += e.offsetLeft; return l;}function getAbsTop(e) {var t=e.offsetTop; while(e=e.offsetParent) t += e.offsetTop; return t;}function closeLayer(){ var n = parseInt(document.forms["mmhide"].sx.value, 10); n += parseInt(document.forms["mmhide"].ls.value, 10); n += parseInt(document.forms["mmhide"].wy.value, 10); currentTR.cells[1].innerText = document.forms["mmhide"].sx.value; currentTR.cells[2].innerText = document.forms["mmhide"].ls.value; currentTR.cells[3].innerText = document.forms["mmhide"].wy.value; currentTR.cells[4].innerText = n; document.getElementById('mmDiv').style.display='none'}var currentTR;function mm(e){ var tr = currentTR = searchObjByTagName(e, "TR"); var layer = document.getElementById("mmDiv"); with(layer.style) { top = getAbsTop(tr) + tr.offsetHeight; left = getAbsLeft(tr); width = tr.offsetWidth; display = "block"; } document.forms["mmhide"].sx.value = tr.cells[1].innerText; document.forms["mmhide"].ls.value = tr.cells[2].innerText; document.forms["mmhide"].wy.value = tr.cells[3].innerText;}//--></SCRIPT> 我写了一个,经过Win2000+IE6测试,有两个文件,main.htm和change.htmmain.htm代码如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><script language="javascript">function ChangeScroll(){ var result=showModalDialog("change.htm",null,"status:no;center:yes;help:no;minimize:no;maximize:no;dialogWidth:400px;scroll:no;dialogHeight:250px"); alert(result); if (result!=""){ var scrolls=result.split(";"); for (var i=0;i<scrolls.length;i++){ var scritem=scrolls[i].split(":"); eval(scritem[0]).innerText=scritem[1]; } sum=parseFloat(math.innerText)+parseFloat(history.innerText)+parseFloat(english.innerText); amount.innerText=sum; }}</script><body><table width="800" border="1" cellspacing="0" cellpadding="0"> <tr> <td>姓名</td> <td>数学</td> <td>历史</td> <td>外语</td> <td>总分</td> </tr> <tr> <td>张三</td> <td id=math>78</td> <td id=history>92</td> <td id=english>85</td> <td id=amount>255</td> </tr></table><input name="Change" type="button" id="Change" value="修改成绩" onClick="ChangeScroll()"><input name="close" type="button" id="close" value="关闭窗口" onClick="if (confirm('是否关闭本窗口?')) window.close();"></body></html>change.htm代码如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><script language="javascript">function result(){ var sum=""; if (document.all("math").value!=""){ sum+="math:"+document.all("math").value+";"; } if (document.all("history").value!=""){ sum+="history:"+document.all("history").value+";"; } if (document.all("english").value!=""){ sum+="english:"+document.all("english").value+";"; } window.returnValue=sum.substr(0,sum.length-1); window.close();}</script><body><table width="200" border="1" cellspacing="0" cellpadding="0"> <tr> <td>数学</td> <td>历史</td> <td>外语</td> </tr> <tr> <td><input type="text" name="math" value=""></td> <td><input type="text" name="history" value=""></td> <td><input type="text" name="english" value=""></td> </tr></table><input name="change" type="button" id="change" value="修改成绩" onClick="result()"><input name="close" type="button" id="close" value="关闭窗口" onClick="if (confirm('是否关闭本窗口?')) window.close();"></body></html> 楼上的都没审题~~!要求一个htm文件~! 回复人: HHH3000(蓝色爱琴海 阿信fans 001号) ( ) 信誉:100 2004-12-15 10:45:00 得分: 0 ---------还有这么抠的题?! 新窗口修改后用opener的方式将修改后的值写回到原窗口~~~`代码懒得写了,好麻烦~~ <HTML><head><script language="javascript">var curRow=null;function SelectRow(TrObj){ if(curRow) curRow.style.backgroundColor="#FFFFFF"; TrObj.style.backgroundColor="#FFCC00"; curRow=TrObj;}function CalTotalScore(){}function ToModify(){ var pWin=window.open("","","width=200px,height=150px,left="+(screen.width-200)/2+",top="+(screen.height-150)/2); pWin.document.write(divOpen.innerHTML); pWin.document.all.txtMath.value=curRow.cells[1].innerText; pWin.document.all.txtHis.value=curRow.cells[2].innerText; pWin.document.all.txtEng.value=curRow.cells[3].innerText;}</script></head><body onLoad="CalTotalScore();"><table align="center" width="500" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse " bordercolor="#111111"> <tr> <td width="100" align="center">姓名</td> <td width="100" align="center">数学</td> <td width="100" align="center">历史</td> <td width="100" align="center">外语</td> <td width="100" align="center">总分</td> </tr> <tr onClick="SelectRow(this)"> <td align="center">张三</td> <td align="right">78</td> <td align="right">92</td> <td align="right">85</td> <td align="right"> </td> </tr> <tr onClick="SelectRow(this)"> <td align="center">李四</td> <td align="right">82</td> <td align="right">68</td> <td align="right">91</td> <td align="right"> </td> </tr> <tr> <td align="center" colspan="5"> <input type="button" value="修改" onClick="ToModify()"> <input type="button" value="关闭" onClick="javascript:window.close();"> </td> </tr></table><div id="divOpen" style="display:none "><script language="javascript">function doSave(){ var opener=window.opener; opener.curRow.cells[1].innerText=txtMath.value; opener.curRow.cells[2].innerText=txtHis.value; opener.curRow.cells[3].innerText=txtEng.value;}</script><table width="80%" align="center" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse " bordercolor="#111111"> <tr> <td width="40%" align="right">数学; </td> <td width="60%"><input type="text" id="txtMath" style="width:100% "></td> </tr> <tr> <td align="right">历史; </td> <td><input type="text" id="txtHis" style="width:100% "></td> </tr> <tr> <td align="right">外语; </td> <td><input type="text" id="txtEng" style="width:100% "></td> </tr> <tr> <td colspan="2" align="center"><input type="button" value="保存" onClick="doSave()"></td> </tr></table></div></body></html> 关于DhtmlxGrid的日期格式 求教 帮忙改一下这段JS代码 alert不执行 用一个js方法获取页面中相同的KEY的数值,其中数值不一样,但是取得是undefined,不是KEY的VALUE的数值?为什么? javascript 加法问题 关于javascript判断数值范围的问题 怎么才能让function返回(return)获取到的responseText? 如何在Javascript接收到asp中传递过来的数据呢? 在table中加入tr的问题 窗体提交后怎样获取客户端属性 如何判断列表框的数据已经存在 如何在两个窗口之间传递对象
document.getElementById("ID").innerHTML
回填到父窗口中
<table border=1 width=400>
<tr>
<td>姓名</td>
<td>数学</td>
<td>历史</td>
<td>外语</td>
<td>总分</td>
<td><input type=button value="关闭窗口" onclick="opener='meizz';close()"></td>
</tr>
<tr>
<td>张三</td>
<td>78</td>
<td>92</td>
<td>85</td>
<td>255</td>
<td><input type=button value="修改成绩" onclick="mm(this)"></td>
</tr>
</table><div id=mmDiv style="position: absolute; z-index: 1; width: 240;
border: 1px solid block; display: none; background-color: yellow">
<form name=mmhide style="margin: 0">
数学: <input name=sx><br>
历史: <input name=ls><br>
外语: <input name=wy><br>
<input type=button value="修改数据">
<input type=button value="关闭窗口" onclick="closeLayer()">
</form>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!--
function searchObjByTagName(obj, tag)
{
while(obj!=null && typeof(obj.tagName) != "undefind")
{
if(obj.tagName == tag.toUpperCase()) return(obj);
obj = obj.parentElement;
}
return null;
}
function getAbsLeft(e){var l=e.offsetLeft; while(e=e.offsetParent) l += e.offsetLeft; return l;}
function getAbsTop(e) {var t=e.offsetTop; while(e=e.offsetParent) t += e.offsetTop; return t;}
function closeLayer()
{
var n = parseInt(document.forms["mmhide"].sx.value, 10);
n += parseInt(document.forms["mmhide"].ls.value, 10);
n += parseInt(document.forms["mmhide"].wy.value, 10);
currentTR.cells[1].innerText = document.forms["mmhide"].sx.value;
currentTR.cells[2].innerText = document.forms["mmhide"].ls.value;
currentTR.cells[3].innerText = document.forms["mmhide"].wy.value;
currentTR.cells[4].innerText = n;
document.getElementById('mmDiv').style.display='none'
}
var currentTR;
function mm(e)
{
var tr = currentTR = searchObjByTagName(e, "TR");
var layer = document.getElementById("mmDiv");
with(layer.style)
{
top = getAbsTop(tr) + tr.offsetHeight;
left = getAbsLeft(tr);
width = tr.offsetWidth;
display = "block";
}
document.forms["mmhide"].sx.value = tr.cells[1].innerText;
document.forms["mmhide"].ls.value = tr.cells[2].innerText;
document.forms["mmhide"].wy.value = tr.cells[3].innerText;
}
//-->
</SCRIPT>
main.htm代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript">
function ChangeScroll(){
var result=showModalDialog("change.htm",null,"status:no;center:yes;help:no;minimize:no;maximize:no;dialogWidth:400px;scroll:no;dialogHeight:250px");
alert(result);
if (result!=""){
var scrolls=result.split(";");
for (var i=0;i<scrolls.length;i++){
var scritem=scrolls[i].split(":");
eval(scritem[0]).innerText=scritem[1];
}
sum=parseFloat(math.innerText)+parseFloat(history.innerText)+parseFloat(english.innerText);
amount.innerText=sum;
}
}
</script>
<body>
<table width="800" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>姓名</td>
<td>数学</td>
<td>历史</td>
<td>外语</td>
<td>总分</td>
</tr>
<tr>
<td>张三</td>
<td id=math>78</td>
<td id=history>92</td>
<td id=english>85</td>
<td id=amount>255</td>
</tr>
</table>
<input name="Change" type="button" id="Change" value="修改成绩" onClick="ChangeScroll()">
<input name="close" type="button" id="close" value="关闭窗口" onClick="if (confirm('是否关闭本窗口?')) window.close();">
</body>
</html>
change.htm代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript">
function result(){
var sum="";
if (document.all("math").value!=""){
sum+="math:"+document.all("math").value+";";
}
if (document.all("history").value!=""){
sum+="history:"+document.all("history").value+";";
}
if (document.all("english").value!=""){
sum+="english:"+document.all("english").value+";";
}
window.returnValue=sum.substr(0,sum.length-1);
window.close();
}
</script>
<body>
<table width="200" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>数学</td>
<td>历史</td>
<td>外语</td>
</tr>
<tr>
<td><input type="text" name="math" value=""></td>
<td><input type="text" name="history" value=""></td>
<td><input type="text" name="english" value=""></td>
</tr>
</table>
<input name="change" type="button" id="change" value="修改成绩" onClick="result()">
<input name="close" type="button" id="close" value="关闭窗口" onClick="if (confirm('是否关闭本窗口?')) window.close();">
</body>
</html>
要求一个htm文件~!
还有这么抠的题?!
代码懒得写了,好麻烦~~
<head>
<script language="javascript">
var curRow=null;
function SelectRow(TrObj){
if(curRow) curRow.style.backgroundColor="#FFFFFF";
TrObj.style.backgroundColor="#FFCC00";
curRow=TrObj;
}
function CalTotalScore(){}
function ToModify(){
var pWin=window.open("","","width=200px,height=150px,left="+(screen.width-200)/2+",top="+(screen.height-150)/2);
pWin.document.write(divOpen.innerHTML);
pWin.document.all.txtMath.value=curRow.cells[1].innerText;
pWin.document.all.txtHis.value=curRow.cells[2].innerText;
pWin.document.all.txtEng.value=curRow.cells[3].innerText;}
</script>
</head><body onLoad="CalTotalScore();">
<table align="center" width="500" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse " bordercolor="#111111">
<tr>
<td width="100" align="center">姓名</td>
<td width="100" align="center">数学</td>
<td width="100" align="center">历史</td>
<td width="100" align="center">外语</td>
<td width="100" align="center">总分</td>
</tr>
<tr onClick="SelectRow(this)">
<td align="center">张三</td>
<td align="right">78</td>
<td align="right">92</td>
<td align="right">85</td>
<td align="right"> </td>
</tr>
<tr onClick="SelectRow(this)">
<td align="center">李四</td>
<td align="right">82</td>
<td align="right">68</td>
<td align="right">91</td>
<td align="right"> </td>
</tr>
<tr>
<td align="center" colspan="5">
<input type="button" value="修改" onClick="ToModify()">
<input type="button" value="关闭" onClick="javascript:window.close();">
</td>
</tr>
</table>
<div id="divOpen" style="display:none ">
<script language="javascript">
function doSave(){
var opener=window.opener;
opener.curRow.cells[1].innerText=txtMath.value;
opener.curRow.cells[2].innerText=txtHis.value;
opener.curRow.cells[3].innerText=txtEng.value;
}
</script>
<table width="80%" align="center" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse " bordercolor="#111111">
<tr>
<td width="40%" align="right">数学; </td>
<td width="60%"><input type="text" id="txtMath" style="width:100% "></td>
</tr>
<tr>
<td align="right">历史; </td>
<td><input type="text" id="txtHis" style="width:100% "></td>
</tr>
<tr>
<td align="right">外语; </td>
<td><input type="text" id="txtEng" style="width:100% "></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="button" value="保存" onClick="doSave()"></td>
</tr>
</table>
</div>
</body></html>