js-face question 1

Source: Internet
Author: User

Values of 1, y, and z?
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);
Y,z Output Undefind
Note: The function does not return a value, the default is Undefind;

2, JS is Object-oriented, how to embody the inheritance relationship JS?
Use prototype to implement

3, how to JS disable checkbox
var box = document.getElementById ("box"); Js
Box.disabled = true;
Jq
$ ("#box"). attr ("Disabled", true);

4, ReadOnly and disabled
ReadOnly is valid for input (Text/possword) and textarea, data can be transmitted
Disabled applies to all form elements, and data is not transportable

5, JS in the 3 kinds of pop-up message reminders (Warning window, confirmation window, information Input window) of the command-type what
Alert ("A");
Confirm ("B");
If the user clicks the OK button, confirm () returns TRUE. If you click the Cancel button, confirm () returns false.
Prompt ("Please enter", "Zhang San");
Prompt (Text,defaulttext)
Text is optional. Plain text to display in the dialog box (instead of HTML-formatted text)
DefaultText is optional. The default input text

6, write Datedemo return results, system time assumed to be today
function Datedemo () {
var d,s = "Today's date is:";
D = new Date ();
s + = D.getmonth () +1+ "/";
s + = D.getdate () + "/";
s + = D.getfullyear () + "/";
return s;
}
Console.log (Datedemo ());

7. The result of operation?
For (i=0, j=0; i<10, j<6; i++, J + +) {
K = i + j;
Console.log (i + "-" +j);
}
Console.log (k + "--------"); 10

8. The result of operation?
var a = "0";
Console.log (typeof (a));
if (a) {
Console.log ("true");
}else{
Console.log ("false");
}
True

The object model (BOM) of the browser?
Window
Window.alert ();
Window.prompt ();
Window.confirm ();
window.open ();
Window.close ();

Document
document.write ();

History//When your users browse the Web, the BOM holds a recent access list, and history is the object
History.back (); Hind legs
History.forward (); Forward
History.go (n); Positive progression, negative hind legs

Location
Location.href
Location.host//Return Web site + port

Screen
Used to display the size and color of a Web page display
Screen.width/screen.height; Represents the resolution of the monitor (total width, height)

8. What are the common objects of JavaScript (DOM)
String (), Math (), Date (), Array ();

9, the difference between innerhtml,innertext,outerhtml?
InnerHTML The output element contains the code + text information;
InnerText the text information contained in the output element;
outerHTML Output contains elements

js-face question 1

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.