关于js和div的简单应用

第一部分

------------------------------------------------------------------------------------------------------------------------------------------------

<html>
  <head>
     <title>JS测试</title>
  </head>
  <style>
    body{
   padding:0;
   spacing:0;
 }
    #top{
   width:800px;
   height:50px;
   background-color:#336699;
   display:block;
 }
 #content{
   spacing-top:1px;
   width:800px;
   height:200px;
   background-color:#336699;
 }
 #foot{
   width:800px;
   height:200px;
   background-color:green;
   border:1 solid red;
 }
  </style>
  <script language="javascript">
    function mo(){
     document.getElementById('content').style.visibility="hidden";
 }
 function no(){
     document.getElementById('content').style.visibility="visible";
 }
 function mo1(){
     document.getElementById('top').style.display="none";
  document.getElementById('content').style.background="yellow";
 }
 function no1(){
     document.getElementById('top').style.display="block";
  document.getElementById('content').style.background="#336699";
 }
 function con(){
     document.getElementById('foot').innerHTML='<font color="red">这个世界很美好!</font><br><input type="text" value="你是个好人" />';
 }
  </script>
  <body>
     <div id="top" οnmοuseοver="mo1();" οnmοuseοut="no1();">
     这是头部
  </div>
  <div id="content" οnmοuseοver="mo();" οnmοuseοut="no();">
     这是内容部分<BR>
  
  </div>
  <div id="foot" οnmοuseοver="con();">
     foot
  </div>
  </body>
</html>

第二部分

----------------------------------------------------------------------------------------------------------------------------------------------

<html>
  <head>
     <title>JS测试</title>
  </head>
  <style>
    #top{
   width:800px;
   height:50px;
   background-color:#336699;
   display:block;
 }
 #foot{
   width:800px;
   height:100px;
   border:1 solid blue;
   text-align:center;
 }
 
  </style>
  <script language="javascript">
  
 function mo1(){
     document.getElementById('top').style.background="red";
 }
 function no1(){
     document.getElementById('top').style.background="#336699";
 }
 function getHTML(){
     var setHTML = document.getElementById('top').innerHTML;
  document.getElementById('foot').innerHTML = setHTML;
 }
  </script>
  <body>
     <div id="top" οnmοuseοver="mo1();" οnmοuseοut="no1();">
     这是头部,你好!
  </div>
  <div id="foot">
    <button οnclick="getHTML();">内容</button>
  </div>
  </body>
</html>

第三部分

------------------------------------------------------------------------------------------------------------------------------------------

<html>
<head>
  <title>页面内容不能被复制</title>
</head>
<style>
@media print{
  body{
  display:none;
  }
}
</style>
<body οncοntextmenu="return false"
      οndragstart="return false"
   onselectstart="return false"
   οnselect="document.selection.empty()"
   οncοpy="document.selection.empty()"
   onbeforecopy="return false"
   οnmοuseup="document.selection.empty()">
  
   好好学习,天天向上!
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值