首页 > 其他分享 >简单实现iframe切换页面

简单实现iframe切换页面

时间:2022-11-04 19:04:44浏览次数:48  
标签:function oIframe request 切换 iframe oInput document changeHeight 页面

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<base href="<%=basePath%>">



<title>My JSP 'index.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0">

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="This is my page">

<!--

<link rel="stylesheet" type="text/css" href="styles.css">

-->

<script type="text/javascript">

window.οnlοad=function(){

var oInput=document.getElementsByTagName('input');

var oIframe=document.getElementById('iframe1');

function changeHeight(){

setTimeout(function(){

oIframe.height=oIframe.contentWindow.document.body.offsetHeight;

},100);





}

changeHeight();

oInput[0].οnclick=function(){

oIframe.src='iframe1.jsp';

changeHeight();

};



oInput[1].οnclick=function(){

oIframe.src='iframe2.jsp';

changeHeight();

};

};



</script>



</head>

<body>

<input type="button" value="切换1"/>

<input type="button" value="切换2"/>

<iframe id="iframe1" src="iframe1.jsp" scrolling="no"></iframe>

</body>

</html>

标签:function,oIframe,request,切换,iframe,oInput,document,changeHeight,页面
From: https://blog.51cto.com/u_10028442/5824683

相关文章

  • 如何设计网页排版和样式 - 前端页面设计
    经过前端页面的优化,请教别人和别人的建议总结出来的两句话,希望可以有所帮助对于没有设计天赋的朋友,不妨可以思考一下下面三句话.设计这东西一定要找素材.自己凭空想......
  • 什么是上下文切换?
    多线程编程这种一般程序的个数都大于CPU核心的个数,而一个CPU核心在任意时刻都只能被一个线程使用,为了让这些线程都能得到有效执行,CPU采取的策略是为每个线程分配时间片并轮......
  • 分享我的装饰博客园页面代码
    本博客代码参考Mr.小扎仙森csdn博客页面定制css代码*,.Cal{padding:0}::-moz-selection{background:#807dd4;color:#FFF}::selection{background:#807dd4;color:#FFF}::......
  • 若依框架 解决(菜单之间跳转,清除缓存。跳转到子页面在回来,缓存还在问题)
    页面中使用  代码beforeRouteLeave(to,from,next){console.log("to",to);if(to.path=="/conentReview/infoDetailPage/index"){//缓存......
  • jupyter跨域ifream页面嵌入配置
    c.NotebookApp.notebook_dir=u'/media/data1/jupyter'c.NotebookApp.allow_remote_access=Truec.NotebookApp.open_browser=Falsec.NotebookApp.password='sha1:dc......
  • 【AGC】云测试服务页面报错问题
    AGC-云测试云调试服务界面报错的问题问题描述:在AGC平台-质量-打开云测试或者云调试页面启用服务时,页面出现空白或者error_code_100006的报错。有的账号无法正常打开网页,但是......
  • html套用layui实现页面弹出层
    效果: 代码:<buttonid="add"onclick="useradd()"class="layui-btn"><iclass="layui-icon">评估</i></button>/*==========添加弹出层父页面button事件=......
  • Jupyter lab 切换kernel
    在使用pytorch的时候需要用到pandas这个包,报错说"nomodulenamedpandas",但是我在终端查找了conda装了pandas,所以不是安装的问题,后面执行了这条语句importsysprint(......
  • [IE编程] 多页面基于IE内核浏览器的代码示例
    有不少人发信问这个问题,我把答案贴在这里:建议参考WTL(WindowsTemplateLibrary)的代码示例工程TabBrowser(在WTL目录/Samples/TabBrowser下面)。该工程演示了如何用W......
  • 【iframe防盗链】解决iframe图片防盗链报403错误
    问题在使用iframe框架引入其他网站时,图片资源因为阿里云防盗链原因,加载不出来,报403的错误。这个问题就算把第三方网站的html源码保存在本地,再用iframe框架载入,都无法加载......