您的位置:首页 > 职场人生

试题_08年阿里巴巴前端面试题

2009-12-07 22:52 399 查看
无意中看到此题,做一下玩玩:

HTML:

<style>
*{ margin:0; padding:0;}
.box {
position:relative;
width:315px; height:279px;}
#box1,#box2,#box3 {
background-color:#CDD8DA;
text-align:center; font-weight:bold;}
#box1 {
position:absolute; left:0; top:0;
width:90px; height:153px; line-height:153px;}
#box2 {
position:absolute; left:0; bottom:0;
width:90px; height:119px; line-height:119px;}
#box3 {
position:absolute; right:0; bottom:0;
width:217px; height:279px; line-height:279px;}	</style>
<body>

<div class="box">
<div id="box1">A</div>
<div id="box2">B</div>
<div id="box3">C</div>
</div>

</body>
</html>


js:

function hoverBig(x){
var x = document.getElementById(x);
var w = x.clientWidth;
var h = x.clientHeight;
var bW = Math.floor( w * 1.25 );
var bH = Math.floor( h * 1.25 );
x.onmouseover = function(){
x.style.backgroundColor = "#DDF8C0";
x.style.width = bW + "px";
x.style.height = bH + "px";
x.style.zIndex = 100;
}
x.onmouseout = function(){
x.style.backgroundColor = "#CDD8DA";
x.style.width = w + "px";
x.style.height = h + "px";
x.style.zIndex = 1;
}

}

hoverBig("box1");
hoverBig("box2");
hoverBig("box3");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: