[关闭]
@TedZhou 2022-01-05T08:07:42.000000Z 字数 1794 阅读 300

Web开发笔试题库

未分类


一、请列举常用的HTML标签。
a)块级元素:div p h1~h6 ol ul li table form
b)行内元素:span a label small ins del u b strong
c)行内块级元素:img input textarea select button
d)空元素:br hr img input
二、请写出几个通用的HTML标签属性并说明其主要用途。
a)class:
b)id:
c)style:
d)title:
e)lang:
三、请列举几个常用的HTML事件。
a)keyboard事件:
b)mouse事件:
c)form事件:
d)window事件:
四、请举出几种隐藏界面元素的方法,并给出示例。
1. style="display:none;"
2. style="visibility:hidden;"
3. style="opacity:0;"
4. 为标签设置hidden属性

五、请说明下列CSS选择器的含义。
a)h1 + p
b)p > span: first-child
c).nav a
d)input[class*=”alt”]
六、请说明CSS选择器确定优先级的规则。
答:按权重。标签的权重为1,class的权重为10,id的权重为100,内联样式的权重为1000, !important声明的权重最高。
七、请说明以下position值的含义及用途。
a)relative:
b)static:
c)absolute:
d)fixed:
八、请定义样式,让下面这个图片在容器内水平和垂直居中显示。

  1. <div class="container" style="width:100%; height:300px;">
  2. <a><img src="a.png"></a>
  3. </div>
  1. .container{display:table; text-align:center;}
  2. .container>a{display:table-cell;vertical-align:middle;}
  3. .container>a>img{max-width:100%; max-height:300px;}

九、请简单描述一下CSS盒子模型。
答:CSS 盒子模型(Box Model) 规定了元素内容(content)、内边距(padding)、边框(border) 和 外边距(margin) 的处理方式。
十、请列出js支持的数据类型。
a)数值(number):
b)布尔值(boolean):
c)字符串(string):
d)对象(object):
e)数组(array):
f)函数(function):
十一、请列出js的内置对象。
a)Number、Boolean、String、Object、Array、Function
b)Date
c)Math
d)Error
e)RegExp
f)Arguments
十二、请说明下列Javascript关键字的用途。
a)void:
b)new:
c)delete:
d)instanceof:
e)typeof:
f)of:
g)in:
十三、使用Javascript实现阶乘函数function f(n)。

十四、下面这段Javascript代码的输出是?

  1. var err;
  2. function tryErr(add){
  3. try{
  4. throw err+=add;
  5. }catch(err){
  6. console.log(err++);//输出:
  7. }
  8. return err
  9. };
  10. console.log(tryErr(err=1));//输出:

十五、下面的对象A有一个属性a和方法print。请编写对象B,使之继承A,并添加一个属性b,覆盖方法print追加打印出属性b的值。

  1. function A(a){
  2. this.a = a;
  3. }
  4. A.prototype.print = function(){
  5. console.log('a=' + this.a);
  6. }
  1. function B(a, b){
  2. A.call(this, a);
  3. this.b = b;
  4. }
  5. B.prototype = (function(){
  6. function T(){};
  7. T.prototype = A.prototype;
  8. return new T;
  9. })();
  10. B.prototype.print = function(){
  11. A.prototype.print.call(this);
  12. console.log('b=' + this.b);
  13. }

十六、请简述闭包的概念,并用Javascript编写一个简单的闭包示例。

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注