获取值相关问题 framset :有个top.aspx 有个right.aspx 我现在在top页面放入一个文本框,right里面放个按钮 ,当我在top页面文本框输入值时,点击right页面的按钮能获取文本框的值。详细代码,谢谢。用js写。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 rigth.aspx里面写<script> top.document.getElementById('top.aspx的iframe的id').document.getElementById('文本框的id').value</script> 你top.aspx的iframe id写对了吗还有top.aspx里面的文本框id 写对了呀,我发给你看看:并且找不到可接受类型为“ASP.right_aspx”的第一个参数的扩展方法“abc”(是否缺少 using 指令或程序集引用?)行 22: <asp:Button ID="Button1" runat="server" Text="Button" OnClick="abc()" />这里报错。 <asp:Button ID="Button1" runat="server" Text="Button" onclick="abc()" />首先你这句就有问题 改成小写~· abc这个方法发上来 我看看 <script type="text/javascript"> function abc() { top.document.getElementById('topFrame').document.getElementById('TextBox1').value; }</script>麻烦你了额。谢谢! <asp:Button ID="Button1" runat="server" Text="Button"/><script type="text/javascript"> document.getElementById('Button1').onclick = function(){ top.document.getElementById('topFrame').document.getElementById('TextBox1').value; }</script>这样试试,把button标签上的那个onclick事件去掉把这段js代码放在button标签的下面 <script type="text/javascript"> document.getElementById('Button1').onclick = function(){ var value = top.document.getElementById('topFrame').document.getElementById('TextBox1').value; alert(value); }</script> 运行,报错。说什么缺少对象,var value =。这一行。 document.getElementById('Button1').onclick = function(){ alert(top.document.getElementById('topFrame')) //看看弹出什么 var value = top.document.getElementById('topFrame').document.getElementById('TextBox1').value; alert(value); } document.getElementById('Button1').onclick = function(){ alert(top.document.getElementById('topFrame')) //看看弹出什么 var value = top.document.getElementById('topFrame').document.getElementById('TextBox1').value; alert(value); } 我加了这个 if(self==top)然后弹出来的是 undefined 这是个乱码吗。 你frameset top.aspx这个iframe的id是topFrame吗?没有拿到对象把你frameset代码发上来 我加了这个 if(self==top)为什么加这个? <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head> <form id="form1" runat="server"> <div> <frameset rows="80,*" cols="*" frameborder="no" border="2" framespacing="2"> <frame src="top.aspx" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" /> <frameset cols="80,*" frameborder="no" border="2" framespacing="2"> <frame src="left.aspx" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" /> <frame src="right.aspx" name="mainFrame" id="mainFrame" title="mainFrame" /> </frameset></frameset></div> </form><noframes><body> </body></noframes></html> 我加了这个 if(self==top)不加这个 也弹出undefined 吗?? 这位朋友,我昨晚做出来了,呵呵,总之是多谢了你额。我这样写的: window.parent.frames("topFrame").document.all.TextBox1.value;你用心了,分数奖励给你啦。 js的问题 本人新手 JQ Grid中单元格数据高亮显示! 图片切换的JS,有时候出现图片乱跳 点击后改变连接的值 这段代码哪出出错了呢?JS下拉框选择层隐藏的问题 正则替换 ! 请大家帮忙如何产生一个xml文件并写成我下面这个格式,谢谢了! JSP网站,我想把所有资料下载到本地硬盘,愿重分相酬谢! 在javascript中,是不是不能用数字作id 求助:如何在javascript中通过代码保留一个数字小数点后指定位数 JQ给<a></a>添加属性的问题 求解释一句代码
top.document.getElementById('top.aspx的iframe的id').document.getElementById('文本框的id').value
</script>
abc这个方法发上来 我看看
function abc() {
top.document.getElementById('topFrame').document.getElementById('TextBox1').value;
}
</script>麻烦你了额。谢谢!
<script type="text/javascript">
document.getElementById('Button1').onclick = function(){
top.document.getElementById('topFrame').document.getElementById('TextBox1').value;
}
</script>
这样试试,把button标签上的那个onclick事件去掉把这段js代码放在button标签的下面
document.getElementById('Button1').onclick = function(){
var value = top.document.getElementById('topFrame').document.getElementById('TextBox1').value;
alert(value);
}
</script>
alert(top.document.getElementById('topFrame')) //看看弹出什么
var value = top.document.getElementById('topFrame').document.getElementById('TextBox1').value;
alert(value);
}
alert(top.document.getElementById('topFrame')) //看看弹出什么
var value = top.document.getElementById('topFrame').document.getElementById('TextBox1').value;
alert(value);
}
你frameset top.aspx这个iframe的id是topFrame吗?没有拿到对象把你frameset代码发上来
<head runat="server">
<title></title>
</head>
<form id="form1" runat="server">
<div>
<frameset rows="80,*" cols="*" frameborder="no" border="2" framespacing="2">
<frame src="top.aspx" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frameset cols="80,*" frameborder="no" border="2" framespacing="2">
<frame src="left.aspx" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
<frame src="right.aspx" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
</frameset></div> </form>
<noframes>
<body>
</body>
</noframes>
</html>
我这样写的: window.parent.frames("topFrame").document.all.TextBox1.value;
你用心了,分数奖励给你啦。