论坛首页 Web前端技术论坛

几道知名网站的js测试题

浏览 4662 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-09-22  
以下是一个网站的js测试题,我挑了几道出来,都是单选题;在不查资料的情况下,来测测你都能拿下么? 
这些题是我敲出来的,当时测试的时候无法拷贝,有敲错的地方,望指正!


Question 1 of 40
Which of the following is true?
a. If onKeyDown returns false,the key-press event is cancelled
b. If onKeyPress returns false,the key-down event is cancelled
c. If onKeyDown returns false,the key-up event is cancelled
d. If onKeyPress returns false,the key-up event is cancelled


Question 7 of 40
Consider the three variables:

someText = 'JavaScript1.2';
pattern = /(\w+)(\d)\.(\d)/i;
outCome = pattern.exec(someText);

What does pattern.ignoreCase contain?

a. true
b. false
c. undefined
d. null
e. 0

Question 8 of 40
Given the following window.open function:

  window.open(url,name,"attributes")
 
How will you ensure the different urls are opened in the same window?

a. The second attribute,name should be the same
b. The name attribute should be null
c. The name attribute should be omitted
d. The name attribute should be different
e. None of the above

Question 12 of 40
You are setting cookies with JavaScript. What happends to cookies.txt data if the file exceeds the maximum size?

a. Your script automatically generates a run-time error
b. Your script automatically generates a load-time error
c. All processed using document.cookie are ignored
d. The file is truncated to the maximum length

Question 14 of 40
How would you invoke the browser's Add To Favorite Dialog?

a. Use the window.AddFavorite method
b. Use the document.AddFavorite method
c. Use the window.external.AddFavorite method
d. It is not possible using JavaScript

Question 18 of 40
Which of the following escape sequences represents form feed?

a. //f
b. 'f'
c. /f
d. \f

Question 21 of 40
You want to be able to manipulate the list of visited URLs.Which object would you use?

a. doucument
b. window
c. history
d. browser
e. form

Question 23 of 40
The statement navigator.platform indicates 'Win16',but you are running Windows NT.Which of the following is true?

a. navigator.platform is supposed to show 'Win16' on Windows NT
b. The userAgent property reflects the correct operating system
c. The property can be modified
d. navigator.platform shows the operating system for which the browser was compiled
e. The browser version is outdated

Question 36 of 40
You want to ascentain the page from which the user has navigated to the current page.How would you accomplish this?

a. It is not possible in javascript. This can be done only through server side scripting
b. Use document.referrer property
c. Use the window object
d. None of the above

Question 37 of 40
You've embedded the document.write() method to write some text within a pair of <TD></TD> table tags.
Upon loading the file,however,you get some garbled junk on the page where that text should be.
What could be the reason for this?

a. The browser does not support JavaScript
b. You are using an older version of the browser
c. The browser does not supprot cookies
   发表时间:2008-09-23  
BAABD DCDBB 请指正 基础不够扎实啊
0 请登录后投票
   发表时间:2009-04-02   最后修改:2009-04-02
以下是我的疑惑,在firefox3下的结果,待解答
Which of the following is true?
a. If onKeyDown returns false,the key-press event is cancelled
b. If onKeyPress returns false,the key-down event is cancelled
c. If onKeyDown returns false,the key-up event is cancelled
d. If onKeyPress returns false,the key-up event is cancelled
解答:不会。写了个小例子发现不管哪个事件返回false都不会导致另一事件取消。查阅资料:事件触发顺序是keydown->keypress->keyup,任何按键都会触发keydown、keyup,而alt、ctr等并不会触发keypress。

Question 14 of 40
How would you invoke the browser's Add To Favorite Dialog?
解答:应该是d。出于安全考虑必须是这样。

Which of the following escape sequences represents form feed?
解答:不大明白。

You want to be able to manipulate the list of visited URLs.Which object would you use?
解答:猜测是history。history有个length属性,不过具体内容不知道怎么取出来。
0 请登录后投票
   发表时间:2009-05-20  
1 A
7 A
8 A
12 D
14 C
18 D
21 C
23 B
36 B
37 A
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics