每日一练 6.12

1. div的高宽等于浏览器可见区域的高宽,浏览器滚动,div始终覆盖浏览器的整个可见区域

<!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=UTF-8">
<title>前端试题(html3/4)</title>
<style type="text/css">
html, body {height:100%;width:100%;margin:0;overflow:hidden;}
#fullDiv {width:100%;height:100%;top:0px;left:0px;position:absolute;background:#eee;border:1px solid red;}
#body {width:100%;height:100%;overflow:auto;z-index:999;position:absolute;top:0px;left:0px;}
</style>
</head>
<body>
<input type="background:red;position:absolute;left:100px;"></input>
<!--div的高宽等于浏览器可见区域的高宽,浏览器滚动,div始终覆盖浏览器的整个可见区域-->
<!--input type="text" style="background:red;"/-->
<div id="fullDiv"></div>
<div id="body">
<div style="height:1000px;border:1px solid black;background:#ee0;position:absolute;"></div>
</div>
<script type="text/javascript">
function getBrowerSize() {
    if(document.compatMode == "BackCompat"){
        cWidth = document.body.scrollWidth;
        cHeight = document.body.scrollHeight;
    }
    else {
        cWidth = document.documentElement.scrollWidth;
        cHeight = document.documentElement.scrollHeight;
    }
    return {width:(cWidth-21)+"px", height:(cHeight - 4)+"px"};
}
var floatDiv = document.getElementByIdx_x_x_x('fullDiv');
alert("width:"+size.width+"    height:"+size.height);
floatDiv.style.height = size.height;
floatDiv.style.width = size.width;
</script>
</body>
</html>

2.怎么把这样一个表
year month amount
1991 1 1.1
1991 2 1.2
1991 3 1.3
1991 4 1.4
1992 1 2.1
1992 2 2.2
1992 3 2.3
1992 4 2.4
查成这样一个结果
year m1 m2 m3 m4
1991 1.1 1.2 1.3 1.4
1992 2.1 2.2 2.3 2.4
答案:
select year, 
(select amount from aaa m where month=1 and m.year=aaa.year) as m1,
(select amount from aaa m where month=2 and m.year=aaa.year) as m2,
(select amount from aaa m where month=3 and m.year=aaa.year) as m3,
(select amount from aaa m where month=4 and m.year=aaa.year) as m4
from aaa group by year

3. 抽象类遵循的原则有哪些?

答案:
(1)abstract关键字只能修饰类和方法,不能修饰字段。
(2)抽象类不能被实例化(无法使用new关键字创建对象实例),只能被继承。
(3)抽象类可以包含属性,方法,构造方法,初始化块,内部类,枚举类,和普通类一样,普通方法一定要实现,变量可以初始化或不初始化但不能初始化后在抽象类中重新赋值或操作该变量(只能在子类中改变该变量)。
(4)抽象类中的抽象方法(加了abstract关键字的方法)不能实现。

(5)含有抽象方法的类必须定义成抽象类。


猜你喜欢

转载自blog.csdn.net/wangjianxin1234/article/details/80823840