<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style>
#box{
width:100px;
height:100px;
background-color: red;
}
</style>
<!--js部分,鼠标滑过盒子的时候,盒子颜色由原来的红色变成绿色,当鼠标从盒子上离开,盒子的颜色又恢复为原来的红色-->
<script>
window.onload=function(){ //function后面的括号不要忘记
function $id(id) //$id(id) 这个函数是用来获取id的
{
return document.getElementById(id); //id是形参变量,不加引号
}
$id("box").onmouseover=function(){ //调用的时候一定要加引号
$id("box").style.backgroundColor="green";
}
$id("box").onmouseout=function(){
$id("box").style.backgroundColor="red";
}
}
</script>
</head>
<body>
<div id="box"></div>
</body>
</html>

随机推荐

  1. spring-boot:run启动时,如何带设置环境参数dev,test.

    这边在linux 启动springboot的jar包时候,多次报错 最终使用 java -jar -Dspring.profiles.active=test demo-0.0.1-SNAPSHOT.j ...

  2. What is the !! (not not) operator in JavaScript?

    What is the !! (not not) operator in JavaScript? 解答1 Coerces强制 oObject to boolean. If it was falsey ...

  3. linux sig Segmentation fault error

    当你发现自己的程序挂了,发现这样的一个报错, 不要慌张,它还是带有一点有用信息的.ps: 如果程序挂了,没有捕抓到这个提示,看一下/var/log/messages对应时间段有没有如下消息.memca ...

  4. wls应用命令部署与卸载

    1.查看wls节点运行状态 [root@localhost lib]# jps [root@localhost lib]# ss -tnlp|grep 23705 2.配置wls环境变量 [deplo ...

  5. playbook部署mangodb

    playbook文件 [root@localhost ~]# cat deploy_mongo.yaml --- - hosts: webservers become: yes become_meth ...

  6. swagger-ui升级swagger-bootstrap-ui界面好看到起飞

    如果项目已经集成了swagger,只需要在pom.xml添加,如果你的项目没有集成swagger,自行百度或看最下方的链接 swagger-bootstrap-ui是Swagger的前端UI实现,目的 ...

  7. Golang基础(5):Go语言反射规则

    Go语言反射规则 - The Laws of Reflection 转:http://my.oschina.net/qbit/blog/213720 原文地址:http://blog.golang.o ...

  8. Windows客户端 Linux服务器通讯 字符编码问题

    Windows下的字符编码默认是gb2312 在Linux下需要转成utf8 才能正确的看到对应的中文编码 提供转换函数 /*------------------------------------- ...

  9. Egret入门学习日记 --- 第七篇(书中 3.9节 内容)

    第七篇(书中 3.9节 内容) 好,今天就来看下 3.9节 的内容. 第一点: 昨天就已经搞定了. 第二点: 也包括在昨天的内容了. 第三点: 如果在构造函数里直接引用组件,就会挂掉. 但是把位置变化 ...

  10. Pytorch实现Top1准确率和Top5准确率

    之前一直不清楚Top1和Top5是什么,其实搞清楚了很简单,就是两种衡量指标,其中,Top1就是普通的Accuracy,Top5比Top1衡量标准更“严格”, 具体来讲,比如一共需要分10类,每次分类 ...