62,025
社区成员
发帖
与我相关
我的任务
分享
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<iframe src="http://localhost:2690/UserLoginForCms.aspx" width="230" frameborder="0" scrolling="no">
</iframe>
</td>
</tr>
</table>
<body style="margin: 0 auto;" onload="displayScreenSize()">
<head>
<script language="javascript">
function displayScreenSize() {
document.getElementById("sWidth").value = document.documentElement.clientWidth;
document.getElementById("sHeight").value = document.documentElement.clientHeight;
}
</script>
</head>
<iframe src="http://localhost:2690/UserLoginForCms.aspx?swidth=sWidth的value值&sHieght=sHeight的value值" width="230" frameborder="0" scrolling="no">
<!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>
<title></title>
<script language="javascript">
function displayScreenSize() {
document.getElementById("sWidth").value = document.documentElement.clientWidth;
document.getElementById("sHeight").value = document.documentElement.clientHeight;
}
</script>
</head>
<body onload="displayScreenSize()">
<input type="hidden" id="sWidth" runat="server"/>
<input type="hidden" id="sHeight" runat="server" />
<div>
<table width="1000" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td>
<iframe src="#" name="mainFrame" id="mainFrame" scrolling="no"
width="230" frameborder="0" onload="initFrame();">
</iframe>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
function initFrame() {
var w = document.getElementById("sWidth").value;
var h = document.getElementById("sHidth").value;
var url = "http://localhost:2690/UserLoginForCms.aspx?swidth=" + w + "&sHieght=" + h;
$('mainFrame').attr('src', url);
}
</script>
</body>
</html>
这个是我整个页面的结构,还是取不出来值,水平有限。。。。虚心求教
<script type="text/javascript">
function initFrame() {
var w = document.getElementById("sWidth").value;
var h = document.getElementById("sHidth").value;
var url = "http://localhost:2690/UserLoginForCms.aspx?swidth=" + w + "&sHieght=" + h;
alert(url);
$('mainFrame').attr('src', url);
}
</script>
这是我写的方法,放在<head>里面或者<iframe>的先都不执行[/quote]我有带
initFrame这样的方法名称么 而且这个要放在尾部,尾部懂么?
<script type="text/javascript">
function initFrame() {
var w = document.getElementById("sWidth").value;
var h = document.getElementById("sHidth").value;
var url = "http://localhost:2690/UserLoginForCms.aspx?swidth=" + w + "&sHieght=" + h;
alert(url);
$('mainFrame').attr('src', url);
}
</script>
这是我写的方法,放在<head>里面或者<iframe>的先都不执行<script type="text/javascript">
var w=document.getElementById("sWidth").value;
var h=document.getElementById("sHidth").value;
document.getElementById("ifam").src = "http://localhost:2690/UserLoginForCms.aspx?swidth=w&sHieght=h";
</script>
[/quote]
楼上是不是拼接错了,"http://localhost:2690/UserLoginForCms.aspx?swidth=" + w + "&sHieght=" + h;
我怎么试好像也是这样拼接的<script type="text/javascript">
var w=document.getElementById("sWidth").value;
var h=document.getElementById("sHidth").value;
document.getElementById("ifam").src = "http://localhost:2690/UserLoginForCms.aspx?swidth=w&sHieght=h";
</script>
<iframe src="#" style="text-align: left" name="mainFrame" id="mainFrame"
width="100%" height="100%" frameborder="0" scrolling="auto" onload="initFrame();">
</iframe>
var url=...//拼接
$('#mainFrame').attr('src', url);