javaScriptDay5
来源:互联网 发布:考研笔记知乎 编辑:程序博客网 时间:2024/06/06 01:24
工作之外的店点击打开链接
效果图
代码
<html lang="zh-CN">
<head>
<title>框架集页面</title>
<script language="JavaScript" type="text/javascript">
var pagesVisited = new Array();
function returnPagesVisited()
{
var returnValue = "您正在访问的下面的页面 ";
var pageVisitedIndex;
var numberOfPagesVisited = pagesVisited.length;
for(pageVisitedIndex = 0; pageVisitedIndex < numberOfPagesVisited; pageVisitedIndex++)
{
returnValue = returnValue + pagesVisited[pageVisitedIndex] + "\n";
}
return returnValue;
}
function addPage(fileName)
{
var fileNameStart = fileName.lastIndexOf("/")+1;
fileName = fileName.substr(fileNameStart);
pagesVisited[pagesVisited.length] = fileName;
return true;
}
</script>
</head>
<frameset cols="50%,*" ID="scriptday5"><!-- rows="50%,50% --><!-- 上下rows="50%,50%" 左右各一半 -->
<frame name="LeftWindow" src="LeftWindow.html">
<frame name="RightWindow" src="RightWindow.html">
</frameset>
</html>
四个页面的, 只贴一个,其它三个都和下面的一样,
<html>
<head>
<script language="JavaScript" type="text/javascript">
function butShowVisited_OnClick()
{
//这个方法未执行,未解
//alert(window.parent.returnPagesVisited());
window.document.form1.txtaPagesVisited.value =
window.parent.returnPagesVisited();
}
function butOpneNewWindow_onclick()
{
var windowIndex;//引用
//可以把打开的窗口赋值给一个引用,方便操作它
windowIndex = window.open("LetterCWindow.html","newName","width=260,height=200");//第一个参数是目标加载的对象,第二个参数newName可以随便命名,
//第三个参数不是必须的,可不指定大小,还可以在里面加一些窗口的属性,比如位置、宽高、大小等等
//typeof(windowIndex) == "undefined" 检查有无初始化 windowIndex.closed == true 该窗口是否关闭 true表示关闭
//windowIndex.resizeTo(300,300); 设置窗口大小 单位相素 另有一种方法是resizeBy(x,y)
//windowIndex.moveTo(100,500);移动窗口到指定位置 另一种方法moveBy(x,y);
}
/*@1
function window_onload()
{
alert("这个窗口的名字是 "+window.name+'\r\n'+"它的父类的位置在 "+window.parent.location.href);
}*/
</script>
</head>
<body onload="window.parent.addPage(window.location.href);"><!-- @1 onload="return window_onload()" -->
<center>
<font size=8 color=MidnightBlue face=verdana>
这是页面A
</font>
</center>
<p>
<A href="LeftWindow.html" TARGET="new">页面A</A><!-- target(大小写都可) 打开到一个新窗口 -->
<A href="RightWindow.html" target="RightWindow">页面B</A>
<A href="LetterCWindow.html">页面C</A>
<A href="LetterDWindow.html">页面D</A>
</p>
<form name=form1>
<textarea rows=10 cols=20 name="txtaPagesVisited"></textarea>
<br>
<input type="button" value="显示当前网页" name="butShowVisited"
onclick="butShowVisited_onclick()">
<br>
<input type="button" value="新窗口打开" name="butOpneNewWindow"
onclick="butOpneNewWindow_onclick()">
</form>
<p>窗口a</p>
</body>
</html>
- javaScriptDay5
- IIS6.0 ASP.NET2.0 403错误 解决办法
- ado常量大全
- Linux下访问SQL的应用及移植
- 小明系列之大学时光
- MPI并行程序设计实例教程
- javaScriptDay5
- 用C++实现跨平台游戏开发之Allegro引擎
- 已经进入WIN7系统,我想要修改系统密码,密码忘记了,如何修改
- Struts2页面开发中常用标签使用说明
- Your DbgPrint or KdPrint messages don't appear in WinDbg (or KD) when you run your driver on Windows
- 浅谈C++的类型转换
- buntu 12.04 安装VMware Tools无法找到kernel header path的问题
- JS打乱数组最高效的方法
- codeblocks-12.11编译