从A页面连接到B页面后并直接把B页面的隐藏层显示
从A页面连接到B页面后并直接把B页面的隐藏层显示
发布时间:2016-12-27 来源:查字典编辑
摘要:这个效果实现的是,在B页面里有两个层,一个显示层,我们暂定名c层,一个是隐藏层,我们暂定名d层,单独进B页面的时候,c层显示,d层隐藏,然而...

这个效果实现的是,在B页面里有两个层,一个显示层,我们暂定名c层,一个是隐藏层,我们暂定名d层,单独进B页面的时候,c层显示,d层隐藏,然而从A页面连接到B页面的时候,则是让d层显示,c层隐藏,我觉得这个效果对网页设计者以后会有很大帮助,现在把代码发出来,这里感谢经典的“老二”提供技术帮助。

A页面:

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

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>这是A页面</title>

</head>

<body>

<a href="B.htm?id=show">我要连到B页面</a>

</body>

</html>

B页面:

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>这是B页面</title>

<script language="javascript">

function show()

{

var a=document.location.href;

//alert(a);

if(a.indexOf("id=show")==-1)

{

document.getElementById("hidden").style.display="none";

document.getElementById("show").style.display="block";

}

else

{

document.getElementById("hidden").style.display="block";

document.getElementById("show").style.display="none";

}

}

</script>

</head>

<body onload="show()">

<div id="hidden" style="display:none ">

<font color="red">这里是一个隐藏的层,把我显示出来吧,最好显示我的时候把下面的那个层隐藏掉</font>

</div>

<div id="show">

<font color="blue">这是一个显示的层</font>

</div>

</body>

</html>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新 Div+Css教程学习
热门 Div+Css教程学习
网页设计子分类