JavaScript language

1.Java have any contact with JavaScript?


2.JavaScript is an interpreted language or a compiled language?


Whether 3.JavaScript language can develop server program?


What 4.node.js that?


What 5.jQuery that?


6. <script> tag may define statements and execution of the JS JS function directly. right?


7. <script> tag may be located in any part of the document, but is generally placed in the <head>. right?


8.JS is based on the object and event-driven language words described execution of the following code:
<INPUT type = value = Button Test onclick = "aa ();" />


9. The code below, void (0) What is the role:


<a href="javascript:void(0);" onclick="bb();"> test the introduction of external JS files </a>


10.JavaScript comments like java?


11. [machine] on how to introduce a defined external JS file. Use code description.


12. how to understand "there is no variable type, data typed" this sentence?


13. What must declare a variable named begin with?


14. Which of the following variable declaration is a local variable which is a global variable? And what is wrong?


function aa(){
var g = 22+pp;
var c=1,d=2;
a = "aaa";
var date = new Date();
}

[15.] JS strings machine can use single quotes double quotes may be used. Please use the following double quotes
single quotes skills to do the processing.


var d = "<img src = \" aaaa.jpg \ "/>";
The following code is how what is the problem? How to solve? (Experience and double quotation marks usage)
var D = "<IMG the src =" aaaa.jpg "/>";

 

16. The following code will execute alert statement it? Why?


var g2 = parseInt("sdfdfsd");
if(g2!=g2){
alert(g2);
}

17. "===" and "==" What is the difference?


18. [machine] test Here are a type conversion code, we summed up what the law:


testDataTypeAutoConvert function () {
var A = "true";
var B = true;
var C =. 1;
var D = null;
var E;
Alert (A == B); // string "true" is not converted to a Boolean true (for the same false)
Alert (A == C); // string "true" can not be converted to a digital 1 (for the same false)
Alert (B == C); // can be converted into a digital true (for and the same false 0)
Alert (D == E); // null and undefined can turn each
alert (0 == e); // number 0 and null, undefined not turn
alert (123 == "123") ; // strings and numbers can be automatically converted
}

 

Whether the length of the array of 19.JS variable at any time?


20. The two common ways to write the array definition


21. The array, join, shift, pop, push methods are what role? Write their own test code.


22.JS function definition in the two most common way is to? Use Code Description


23. The following code is wrong it?


function aa(var a,var b){
alert(a+b);
}

 

24. Below the code, we call ee function, the final result is executed?


function CC = var () {
Alert ( "function is also an object!");
}

function dd (S) {
S ();
}

function EE () {
var CC = R & lt;
dd (R & lt);
}

25. Built-in functions: isNaN, escape, unescape, eval, parseInt, parseFloat have any effect?


26. The event has the following to say what role:


onload,onunload,onblue,onchange,onfocus,onkeypress,onkeydown,
onkeyup,onmouseover,onmousemove,oncopy,onbeforecopy


id 27. an element is aa, then the JavaScript object for the element can be obtained by any corresponding method.


28. [machine] operating JavaScript CSS properties of an element, by style, className do.

Illustrated with examples.


29.Date in getTime method What does this mean? What does it mean number returned?


[30.] using Math object machine implemented method to obtain a random number between 100-200.


31.var a = "aaaabbb"; a String object methods can use it?


32. [machine] define a class: Automotive: Contains attributes: price, brand. Method: start, stop.
And two new car objects.


33. [machine] by the prototype property, realization Audi car, to inherit the title in the car category.
And increase their brand new method: run ()


34. [machine] by JSON way, the definition of three students object. Properties include: name, age,
contains methods: learning.


[35] on the machine by way of JSON, defines a teacher object. Properties include: name, subject, students.
Methods include: teaching.


[36] machine by the open window object method, to achieve a small window opening. No toolbars,
status bar, menu, address bar.


[37] use of the timing control unit, realized once every 5 seconds Baidu request. Next to a cancel button, when clicked,
will not visit Baidu.


38. [machine] say history, navigator, the role of location of the object. And become familiar with the classroom teacher code.


What 39.DOM stands for?


40. Is the last generation browser based on the DOM object to load the source code?


41. Write three ways direct access to an element node.


42. How to get the parent node of an element?


43. How do you get all the child nodes of an element?


44. [machine] on how to get an element following the element node (Note: It must be an element node). Implemented in the code


45. [machine] use innerHTML, the following code to replace a div


46. ​​[machine] for a DIV element has increased <img> element. Exercise with appendChild,

Methods to achieve insertBefore


47. [machine] using an element removeChild delete the document. Implemented in the code


48. [machine] to replace an existing node. Implemented in the code


49. [machine] written form objects get six ways.


50. [machine] Viewer dom debug mode browser, Property Browser form object.


51. The form is submitted by the following JS code will not be a problem:


<form name = regFrm action = " aaa.jsp" method = "post" id = "form1Id">
User Name: <input type = text name = uname value = "aa bb" /> <br/>
Password: <input pwd = password name = type /> a
<Submit INPUT type = submit name = value = Submit />
</ form>
the JS Code:
var = document.regFrm FRM4; // simplest and most commonly used
FRM4 .submit ();

52. [machine] a form action = "1.jsp", we can modify the action value in JS code
2.jsp, then submit. Please write code.


53. Operating text field, defaultValue and value What is the difference?


54. The form object if I already have a text field objects, how to get where?


55. [machine] satisfy the following requirements: Click on a button, the button is grayed state, and increased 10 seconds down
timer. Time after, you can click the button.


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script>
function test(){
var a = document.getElementById("btn");
a.disabled=true;
var i = 10;
var b = setInterval(function(){
a.value="测试("+i+")";

if(i==0){
a.value="测试";
a.disabled = false;
clearInterval(b);
}
i--;
},1000);
}
</script>
</head>
<body>
<input type=button id=btn value=测试 /><br/>
<input type=button value=倒计时 onclick="test();" /><br/>
</body>
</html>


56. [machine] implement all check box, and deselect all, anti-election operation.


[57] machine JS code used to dynamically generate a drop-down list.


Note: JS processing drop-down list with a browser differences. Ie Firefox and different approach.
685. [machine] to complete classroom teachers Code (knock once on the course, at least one knock after class!)


58. The following code completion features what? Please briefly described.


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style>
.error {color:red;}
</style>
<script src="util.js"></script>
<script>

function check(frm){
var uname = frm.uname.value.trim();
var pwd = frm.pwd.value.trim();
var pwd2 = $("pwd2").value.trim();
var flag = true;


$("unameMsg").innerHTML="";
$("pwdMsg").innerHTML="";
if(uname.length==0){
$("unameMsg").innerHTML="&times;用户名不能为空!";
flag = false;
}

if(pwd.length==0){
$("pwdMsg").innerHTML="&times;密码不能为空!";
flag = false;
}

if(pwd!=pwd2){
$("pwdMsg").innerHTML="&times;两次输入密码不一致!";
flag = false;
}

var flag2 = false;
for(var i=0;i<frm.favorite.length;i++){
if(frm.favorite[i].checked){
flag2 = true;
break;
}
}
$("favoriteMsg").innerHTML = "";
if(!flag2){
$("favoriteMsg").innerHTML="&times;该项必选!";
}

return flag&&flag2;
}
</script>
</head>
<body>
<form name=regFrm onsubmit="return check(this);" >
用户名:<input type=text name=uname /><span class="error" id=unameMsg></span><br/>
密码:<input type=password name=pwd /><span class="error" id=pwdMsg></span><br/>
确认密码:<input type=password id=pwd2 /><br/>
喜欢做的事:<span class="error" id=favoriteMsg></span><br/>
<input type=checkbox name=favorite value=1 />学Java <br/>
<input type=checkbox name=favorite value=2 />用Java <br/>
<input type=checkbox name=favorite value=3 />教Java <br/>
<input type=submit value=提交 />
</form>
</body>
</html>

Guess you like

Origin www.cnblogs.com/ren549047861/p/11294681.html