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>
are undefined because there is no return value.
2.javascript is object-oriented, how to embody the JavaScript inheritance relationship?
Use prototype to implement.
3.javascript How to select a checkbox, how to set it invalid?
Document.all.cb1[0].disabled = true;
4.form input can be set to ReadOnly and disable, ask 2 What is the difference?
ReadOnly is not editable, but can be selected and copied; values can be passed to the background
Disabled cannot be edited, cannot be copied, cannot be selected, values cannot be passed to the background
What are the commands for 3 pop-up message Reminders (Warning window, confirmation window, information Input window) in 5.js?
Alert
Confirm
Prompt
What types of input are in 6.form?
What is the difference between the 2 variable ranges of 7.javaScript?
Global variables: Valid on current page
Local variables: Valid within method
8. Enumerate the 3 main data types of JavaScript, 2 types of composite data and 2 special data types.
Primary data type: String, Boolean, number
Composite data type: function, Object
9. How do you catch exceptions in your program?
Window.error
Try{}catch () {}finally{}
10. Write out the return result of function Datedemo, 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: Today's date is: 7/17/2010
11. Write out the results of the program running?
For (i=0, j=0; i<10, j<6; i++, J + +) {
k = i + j;
}
Results: 10 (Beware of traps)
12. The results of the operation?
function Hi () {
var A;
alert (a);
}
Result: undefined
13. The results of the operation?
function Hi () {
var a = null;
alert (a);
}
Result: null
14. The object model of the browser?
Window
Top-level objects
Window.alert (msg)
Window.prompt ()
Window.confirm ()
if (Window.confirm ()) {
...
}
window.open ()
Window.close ()
Document
document.write ()
History
When a user browses to a Web page, the browser saves a list of URLs for the most recently visited Web page. This list is represented by a History object.
History.back (): Back
History.forward (): Forward
History.go (n): Positive number indicates forward, negative number indicates backward
Location
Represents the URL information for a window or frame that is currently open.
Location.href: redirect
Equivalent to Location.assign (URL)
Location.host: Similar to www.163.com:80
Navigator
Represents the browser's information and JS operating environment
Navigator.cookieenabled: This property indicates whether cookies are enabled
Screen
The size and color of the monitor used to display the Web page
Screen.width/screen.height: Indicates the resolution of the display (total width, height)
What is the 15.XMLHTTPRequest object?
Ajax Principles
16. The optional value of the attribute target for the hyperlink: What is the difference between _blank, _parent, _self, _top, and frame names?
What are the 17.javascript common objects?
String, Math, date, and array objects
18.innerhtml,innertext,outerhtml,innertext the difference?