5.15随笔

onfocus用法
onfocus 事件在对象获得焦点时发生。
Onfocus 通常用于 <input>, <select>, 和<a>.
提示:onfocus 事件的相反事件为onblur 事件。
<html>
<head>
<title>onfocus</title>
</head>
<head>
<script>
function myFunction(x){
x.style.background="yellow";
}
</script>
</head>
<body>
输入你的名字: <input type="text" onfocus="myFunction(this)">
</body>
</html>

onmouseover用法
onmouseover 属性在鼠标指针移动到元素上时触发。
<html>
<head>
<title></title>
<script>
function bigImg(x){
x.style.height="64px";
x.style.width="64px";
}
function normalImg(x){
x.style.height="32px";
x.style.width="32px";
}
</script>
</head>
<body>
<img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="0.jpg" alt="aaas" width="32" height="32">
</body>
</html>


link与@import区别与选择

首先link和import语法结构不同,前者<link>是html标签,只能放入html源代码中使用,后者可看作为css样式,作用是引入css样式功能。import在html使用时候需要<style type="text/css">标签,同时可以直接“@import url(CSS文件路径地址);”放如css文件或css代码里引入其它css文件。
本质上两者使用选择区别不大,但为了软件中编辑布局网页html代码,一般使用link较多,也推荐使用link。


为什么谷歌不显示visited高度

基于隐私安全的原因,浏览器限制了:visited伪类只能使用color属性,其他无效,故您的设置无法实现。如果您需要实现此类视觉效果,可以考虑利用js结合点击事件进行样式设置。document.getElementById("divId").style.height="200px";document.getElementById("divId").style.width="200px";

posted @ 2017-05-15 22:29  云随风走  阅读(81)  评论(0编辑  收藏  举报