A complete set of JavaScript questions (partial answers) _javascript Tips

Source: Internet
Author: User
Tags html tags spl object model reserved javascript array java comparator
First, single selection
1. Which of the following statements will result in a run-time error: (a)
A.var obj = ();//Syntax error
B.var obj = [];//Create array
C.var obj = {};//Create object
D.var obj =//;
Reason: var obj = new Array (); is right; JavaScript braces represent creating objects. var obj = {id:1, name: "Jacky"};alert (Obj.name); The example above indicates the creation of an object with a property ID (value of 1), property name (value is Jacky). Property names can be quoted as "id", "name", or not.
Of course, you can create methods in addition to attributes.

Test code
/* Window.onload=function ()
{
var obj = ();
var obj1 = [];//object
var obj2 = {};//object
var obj3 =//;//undefine
Alert (typeof (Obj1));
Alert (typeof (Obj2));
Alert (typeof (Obj3));
}*/


function ShowName ()
{
alert (this.name);
}
var obj = {id:1, name: "Jacky", Showname:showname};
Obj.showname ();

2. Which of the following words does not belong to the JavaScript reserved word: (b)
A.with
B.parent
C.class
D.void
The following reserved words cannot be used as variables, function names, object names, and so on, and some of the reserved words are used for later JavaScript extensions.

•  abstract

•  boolean

•  break

•  byte

•  case

•  catch

•  char

•  class

•  const

•  continue

•  default

•  do

•  double

•  else

•  extends

•  false

•  final

•  finally

•  float

•  for

•  function

•  goto

•  if

•  implements

•  import

•  in

•  instanceof

•  int

•  interface

•  long

•  native

•  new

•  null

•  package

•  private

•  protected

•  public

•  return

•  short

•  static

· Super

· Switch

· synchronized

· This

· Throw

· throws

· transient

· true

· Try

· var

· void

· while

· with


3, please select the expression of the result is true: (c)
A.null instanceof Object (if (!) ( Null instanceof Object) is true)
B.null = = undefined
C.null = = undefined
D.nan = = NaN
(1) Null can indeed be understood as the original type and cannot be understood as Object!
Null,int,float ..... These types, which are represented by keywords, do not belong to object.
As for the argument that null can be a parameter, it is only a special rule.
You can understand this:
Object refers to the value of a memory, NULL is a null reference, can be understood as the memory value of 0;
(2) function F1 () {
}
1. Alert (F1 instanceof Function);//true
2. Alert (F1 instanceof Object);//true
3. Alert (Function instanceof Object);//true
4. Alert (Object instanceof Function);//true
function is an instance of object, and object is an instance of function
The function is the constructor of the functions, and object is also a function.
Object.prototype is the apex of all prototype chains, and instanceof will look for the entire prototype chain.
alert (Function);
alert (Function.prototype);
alert (function.__proto__);
alert (Object);
alert (Object.prototype);
alert (object.__proto__);
Alert ((function () {}). prototype);
Alert ((function () {}). __proto__);
Alert ((function () {}). __proto__.prototype);
Alert ((function () {}). prototype.__proto__);
alert (array.__proto__);
Alert ((123). __proto__);
Alert ((number). __proto__);
Alert (("test"). __proto__);
Alert ((String). __proto__);
Alert ((True). __proto__);
Alert ((Boolean). __proto__);
/* Window.onload=function ()
{
if (Nan = = Nan)
{
Alert ("ddd");
}
}
*/
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
The main reason C.firefox and IE have a lot of compatibility problems is that their support for JavaScript is different
D.ajax technology must use JavaScript technology
5. The Foo object has the ATT attribute, so the value of the Att property is obtained, which of the following is possible: ()
A.foo.att
B.foo ("Att")
C.foo["ATT"]
D.foo{"Att"}
E.foo["a" + "T" + "T"]
6. What kinds of HTML tags can enter text manually without specifying special attributes: (ACE)
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)
The A.window.opener property itself is pointing to the Window object
B.window.reload () method can be used to refresh the current page
The role of c.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, combining text This paragraph structure, talk about the difference between innerHTML outerhtml 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?
The Web page consists mainly of three parts: structure (Structure), performance (presentation) and behavior (Behavior). The corresponding web site standards are divided into three aspects: structured standard language, mainly including XHTML and XML; the performance standard language mainly includes the CSS; The behavior standard mainly includes object model (such as the ECMAScript), and so on.
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.
<textarea id="runcode80086"><ptml> <pead> <script> function foo () {//Add code here var RG = Document.getelementsbyname ("Radi Ogroup "); for (var i = 0; i < rg.length i++) {if (rg[i].checked) {alert ("You have selected the first" + (i+1) + "single Box"); return false; } </script> </pead> <body> <form name= "Form1" onsubmit= "return foo ();" > <input type= "Radio" name= "Radiogroup"/> <input type= "Radio" name= "Radiogroup"/> <input type= "Radi" O "name=" Radiogroup "/> <input type=" Radio "name=" Radiogroup "/> <input type=" Radio "name=" Radiogroup "/> <input type= "Radio" name= "Radiogroup"/> <input type= "Submit"/> </form> </body> </HTML&G T </textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.
<ptml> <pead> <script> function foo () {var s TR = 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, complete 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> </pead> <body> <input type= "button" value= "str" onclick= "foo ()"/> </body> </ptml>
[ctrl+a All selected note: If you need to introduce external JS need to refresh to perform]

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.