JavaScript written questions with answers @20081025_jb51.net_javascript tips

Source: Internet
Author: User
Tags html tags spl javascript array java comparator
First, single selection
1. Which of the following statements will result in A run-time error: (A)
A.var obj = ();
B.var obj = [];
C.var obj = {};
D.var obj =//;

2. Which of the following words does not belong to the JavaScript reserved word: (B)
A. With
B. Parent
C. Class
D. void
3, please select the expression of the result is true: (C)
A. Null instanceof Object
B. Null = = undefined
C. Null = = undefined
D. Nan = = Nan

Second, the indefinite choice question
4, please choose to understand the JavaScript error: (ABCD)
A. JScript is the abbreviation for JavaScript
B. JavaScript is a Java scripting language developed by Netscape for the purpose of simplifying Java development difficulties
C. Firefox and IE have a large number of compatibility problems because their support for JavaScript is different
D. Ajax technology must use JavaScript technology
5. The Foo object has the Att property, so the value of the Att property is obtained, which of the following is possible: (ACE)
A. Foo.att
B. Foo ("Att")
C. foo["ATT"]
D. foo{"Att"}
E. foo["a" + "T" + "T"]
6, in the case of no special attributes, which kinds of HTML tags can be manually entered text: (AB)
A. <TEXTAREA></TEXTAREA>
B. <input type= "text"/>
C. <input type= "hidden"/>
D. <DIV></DIV>
7. Which of the following are global functions of javascript: (ABC)
A. Escape
B. parsefloat
C. Eval
D. settimeout
E. Alert
8, the right to express the IFRAME: (ABCD)
A. Through IFRAME, Web pages can be embedded in other Web content and can be dynamically changed
B. Under the same domain name, the embedded IFRAME can get the object of the outer page
C. Under the same domain name, the outer page script can get the objects within the IFRAME page
D. The size of the IFRAME can be adjusted by scripting
9. The correct statements about the form are as follows: (ABCDE)
A. The table can contain TBODY elements
B. The table can contain caption elements
C. A table can contain multiple tbody elements
D. The table can contain colgroup elements
E. The table can contain COL elements
10, on IE, the window objects are expressed correctly: (ACD)
A. The Window.opener property itself is pointing to the Window object
B. Window.reload () method can be used to refresh the current page
C. The role of window.location= "a.html" and window.location.href= "a.html" is to replace the current page with the a.html page
D. Define global variable G; You can access the variable in a WINDOW.G way

Third, question and answer question:
1, talk about the use of JavaScript array sorting method sort (), focusing on the use of sort () parameters and its internal mechanism
The implementation of sort is similar to the Java comparator, where data sorting is sorted from the first dimension of the multidimensional array
You can define your own sorting methods, very few functions
2. Briefly describe the difference between DIV elements and span elements.
Div has carriage return, span not
3, combined with <span id= "outer" ><span id= "inner" >text</span></span> this structure, talk about innerHTML outerhtml The difference between innertext.
It's just a matter of writing and seeing clearly.
innerHTML objects inside the html,outerhtml include objects and the inside of the
Text inside the InnerText object
4, say a few XHTML specification content (at least 3)
Attribute with quotes, cannot have mismatched labels, add definition
5, on the Web Standardization (or Web site refactoring) know what the relevant knowledge, briefly describe a few you know the Web standards?
Standard of the Consortium
Four, the procedure question:
1, complete the content of the Foo () function, ask to be able to pop-up dialog box prompts the currently selected is the first few radio boxes.
<body>
<script>
function foo () {
Add code here
var RG = Document.getelementsbyname ("Radiogroup");
for (var i = 0; i < rg.length; i++)
{
if (rg[i].checked)
{
Alert ("You have selected the first" + (i+1) + "a single marquee");
}
}
return false;
}
</script>
<body>
<form name= "Form1" onsubmit= "return foo ();" >
<input type= "Radio" name= "Radiogroup"/>
<input type= "Radio" name= "Radiogroup"/>
<input type= "Radio" name= "Radiogroup"/>
<input type= "Radio" name= "Radiogroup"/>
<input type= "Radio" name= "Radiogroup"/>
<input type= "Radio" name= "Radiogroup"/>
<input type= "Submit"/>
</form>
</body>
2, fill in the annotation part of the function body, make the Foo () function call pop-up "Success" dialog box. The code should be as brief as possible.
<body>
<script>
function foo () {
var str = reverse (' a,b,c,d,e,f,g ');
alert (str);
if (str = = ' g,f,e,d,c,b,a ') alert (' Success ');
Else alert (' failed ');
}
function reverse (str)
{
Add code here to complete the string rollover function
var SPL = Str.split (', ');
var newstr= "";
for (i=spl.length-1;i>=0;i--)
{
Newstr+=spl[i]+ ', ';
}
Newstr=newstr.substring (0,newstr.length-1)
return newstr;
}
</script>
</HEAD>
<BODY>
<input type= "button" value= "str" onclick= "foo ()"/>
</BODY>
</HTML>
function reverse (str) {
Add code here to complete the string rollover function
Return Str.split (","). Reverse (). Join (",");
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.