JavaScript Questions and Answers with Answer Reference_Javascript Skills
WBOY
Release: 2016-05-16 18:34:35
Original
1228 people have browsed it
1. How to get the text of the selected part of the form
2. Two methods for javascript to control the hiding and display of page controls
javascript to control the hiding and display of page controls Two methods, the difference lies in whether the control still occupies space on the page after being hidden Method 1: document.all["PanelSMS"].style.visibility="hidden"; document .all["PanelSMS"].style.visibility="visible"; Method 2: document.all["PanelSMS"].style.display="none"; document.all[" PanelSMS"].style.display="inline"; After method one is hidden, the position of the page is still occupied by the control, but it is not displayed. Similar to the Display=Static of the .net verification control After method two is hidden, the position of the page is not displayed. Occupied by Display=Dynamic similar to .net validation control 3. var a = 10; var b = 20; var c = 10; alert(a = b); alert(a == b); alert(a == c); The result is?
The following is the answer: a = b is assignment, a == b is the text of the selected part of the lect> field to determine whether the values are the same? 4. Write a method to find the byte length of a string?
5. How to control line breaks in alert
6. Follow the format xxxx year xx month xx day xx hour xx minute xx second dynamic display time requirement is less than 10 to add 0?
7. Write a method to remove duplicate elements from an array
8.js How to use SetInterval and setTimeout?
The delay time/interaction time is in milliseconds (1000ms=1s) setTimeout is executed once after delaying the specified time after loading, and only executes Once SetInterva is executed, it will execute the expression every specified time after loading 1) Basic usage: Execute a piece of code: var i=0; setTimeout("i =1;alert(i)",1000); Execute a function: var i=0; setTimeout(function(){i =1;alert(i); },1000); The following is another function execution: var i=0; function test(){ i =1; alert(i); } setTimeout("test()",1000); You can also do this: setTimeout(test,1000); 2)
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn