在日常开发中,如果我们在当前页面需要刷新打开新的页面,或者涉及到当前页面跳转的问题,我们该如何解决呢?其实我们可以需要刷新当前页面或者覆盖当前页面,在当前页面打开新的地址。
一、在当前页面打开新的页面实现过程:
1、需要刷新当前页面或者覆盖当前页面,当前页面打开新的地址。
window.open('http://www.baidu.com','_self');
2、如果在a标签中进行跳转那么就是用到了target,当前页面打开。
<ahref="http://www.baidu.com"class="class1"target="_self">
二、具体实现代码:
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
</head>
<body>
<scripttype="text/javascript">
functionon(html){
window.open(html,'_self')
}
</script>
<inputtype="button"οnclick="on('sdkjf')"value="sdfkgh">
</body>
</html>
原文来自:https://www.py.cn
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END


















































暂无评论内容