1. What is the value of Y and Z?
<SCRIPT type = "text/JavaScript">
VaR x = 1;
Var y = 0;
VaR z = 0;
Function add (n) {n = n + 1 ;}
Y = add (X );
Function add (n) {n = N + 3 ;}
Z = add (X );
</SCRIPT>
All are undefined, because there is no return value.
2. Javascript is object-oriented. How does one reflect the inheritance relationship of JavaScript?
Use prototype.
3. How does JavaScript select a checkbox and set it to invalid?
Document. All. CB1 [0]. Disabled = true;
4. The input in form can be set to readonly and disable. What is the difference between them?
Readonly cannot be edited, but can be selected and copied; values can be passed to the background
Disabled cannot be edited, copied, or selected; value cannot be passed to the background
5. What are the imperative types of three pop-up message reminders (warning window, confirmation window, and Information Input window) in JS?
Alert
Confirm
Prompt
6. What types of input are in form?
7. What are the differences between the two types of JavaScript variables?
Global variable: valid on the current page
Local variable: valid in Method
8. list three main data types of JavaScript, two composite data types, and two special data types.
Main data types: String, Boolean, number
Composite data type: function, Object
9. How to capture exceptions in the program?
Window. Error
Try {} catch () {} finally {}
10. Write the returned results of the datedemo function. The system time is assumed to be today.
Function datedemo (){
VaR D, S = "today's date is :";
D = new date ();
S + = D. getmonth () + "/";
S + = D. getdate () + "/";
S + = D. getyear ();
Return S;
}
Result: The current date is 7/17/2010.
11. Write the program running result?
For (I = 0, j = 0; I <10, j <6; I ++, J ++ ){
K = I + J;
}
Result: 10(Careful traps)
12. What are the running results?
Function hi (){
VaR;
Alert ();
}
Result: Undefined
13. What are the running results?
Function hi (){
VaR A = NULL;
Alert ();
}
Result: null.
14. What is the browser's object model?
Window
Top-level object
Window. Alert (MSG)
Window. Prompt ()
Window. Confirm ()
If (window. Confirm ()){
...
}
Window. open ()
Window. Close ()
Document
Document. Write ()
History
When a user browses a webpage, the browser saves a list of URLs of the recently accessed webpage. This list is represented by the history object.
History. Back (): Back
History. Forward (): Forward
History. Go (n): positive number indicates forward, negative number indicates backward
Location
Indicates the URL Information of the currently opened window or framework.
Location. href: Redirection
Equivalent to location. Assign (URL)
Location. HOST: similar to www.163.com: 80
Navigator
Indicates the browser information and JS running environment
Navigator. cookieenabled: Indicates whether to enable cookie.
Screen
Display the display size and color of a webpage
Screen. width/screen. Height: Display resolution (total width, height)
15. What is the XMLHTTPRequest object?
Ajax principles
16. Optional values of the Target attribute of the hyperlink: _ blank, _ parent, _ Self, _ top, and framework name. What are the differences between them?
17. What are common JavaScript objects?
String, math, date, and array objects
18. What are the differences between innerhtml, innertext, outerhtml, and innertext?
From: http://qiutian110119.blog.163.com/blog/static/54617311201071751952487/