JavaScript face questions

Source: Internet
Author: User


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 inheritance relationship of JavaScript?
Use prototype to implement.

3.javascript How to select a checkbox, how to set it invalid?
Document.all.cb1[0].disabled = true;

The input in 4.form can be set to ReadOnly and disable, what is the difference between 2 people?
ReadOnly cannot be edited, but can be selected and copied; values can be passed to the background
Disabled cannot be edited, cannot be copied, cannot be selected, value cannot be passed to the background

What are the commands of the 3 pop-up message reminders in 5.js (Warning window, confirmation window, Information Entry window)?
Alert
Confirm
Prompt

What are the types of input in 6.form?

Text: TextBox
Password: Password box
Radio: Radio button
CheckBox: check box
File: Select a domain
Hidden: Hidden Fields
Button: Buttons
Reset: Reset button
Submit: Form Submit button
Image : Picture button, similar to submit can add a picture to a button ...


What is the difference in the range of 2 variants of 7.javaScript?

Global variables: Active in the current page

Local variables: Valid in method

8. Enumerate the 3 main data types of JavaScript, 2 composite data types and 2 special data types.

Primary data type: String, Boolean, number

Composite data type: function, Object

Special type: null undefined

9. How do I catch an exception in my program?

Window.error

Try{}catch () {}finally{}

10. Write the return result of the 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 the results of the program run?

For (i=0, j=0; i<10, j<6; i++, J + +) {

K = i + j;

}

Result: Ten( beware of traps )

12. What are the results of the operation?

function Hi () {
var A;
alert (a);
}

Results: undefined

13. What are the results of the operation?

function Hi () {
var a = null;
alert (a);
}

Result:null

14. What is the browser object model?

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 a Web page, the browser saves a list of URLs for the most recently visited Web page. This list is represented by the history object.

History.back (): Back

History.forward (): Forward

History.go (n): Positive indicates forward, negative indicates backward

Location

Represents the URL information for the currently open window or frame.

Location.href: redirect

Equivalent to Location.assign (URL)

Location.host: Similar to www.163.com:80

Navigator

Indicates the browser information and JS running environment

Navigator.cookieenabled: This property indicates whether cookies are enabled

Screen

The size and color of the display used to display the Web page

Screen.width/screen.height: Indicates the resolution of the monitor (total width, height)

What is a 15.XMLHTTPRequest object?
Ajax Principles

16. What is the difference between the _blank, _parent, _self, _top, and frame names for the hyperlink's properties of the target?

What are the common objects of 17.javascript?

String, Math, date, and array objects

The difference between 18.innerhtml,innertext,outerhtml,innertext?

Transferred from: http://www.cnblogs.com/joetao/articles/1967017.html

JavaScript face questions

Related Article

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.