Eval ("1+2"),-> 3
The dynamic judgment of strings in source code is a very powerful language feature that is hardly necessary to be applied in practice. If you use eval (), you should carefully consider whether you really need to use it.
One, eval
JavaScript can be used as a hacker to attack the site of a tool, where the injection of JS (JavaScript) Malicious script is one of the means, then below, we learn how to prevent JS injection attack? Here's a nice statement to share with you:
What
But only from the point of view of debugging, the functions of these debuggers are fully adequate. What I really need is not a JavaScript IDE, but a JavaScript refactoring tool that allows me to quickly refactor JavaScript components, which is much
This article summarizes the common compatibility problems of JavaScript in IE and Firefox browsers. Share to everyone for your reference, specific as follows:
Form
Document.formName.item ("ItemName")
IE: You can use
JavaScript mouse events, click the right mouse button, pop-up div simple instance
Document.oncontextmenu = function () {return false}; Disable the right mouse button menu to display
var res = document.getElementById (' box '); Find div
First, introduce the next 5 kinds of original types
5 of the original types in JavaScript are string, Number,boolean,undefined,null
var name = "Jack";
var age =;
var single = false;
var app; Undefined
Console.log (typeof name);
/* Cookie Library--"Night of the Living Cookie" Version (25-jul-96)
2 Association of Computer Information Technology Co., Ltd., TU geovindu@163.com exchange with each other
3 written By:bill Dortch, Hidaho design
4 The following functions are
Summary
A private variable is declared within an object using the ' var ' keyword, and it can only be accessed by private functions and privileged methods.
Private functions are declared in the object's constructor (or by the Var
1. There is no outerHTML method in Outerhtml,ff compatible with Firefox.
Copy Code code as follows:
if (window. HtmlElement) {
htmlelement.prototype.__definesetter__ ("outerHTML", function (SHTML) {
var r=this.ownerdocument.createrange
Because the vast majority of browsers are compatible with it, you can use it in these browsers. JavaScript is accepted fairly quickly because it is so simple and has a fairly wide range of uses. Many programmers used to think of JavaScript as a "toy
But I also told People later, because there are too many parameters to accept, so if you don't write smart tips very clearly, even I often do not know how to use.
However, the acceptance of many parameters, in addition to the easy to mistake usage,
Achieve 1
Copy Code code as follows:
String.prototype.trim = function () {
return this. Replace (/^\s\s*/, '). Replace (/\s\s*$/, ');
}
It does not look very good, using two of regular replacements, the actual speed is
And for the picture tag IMG also has an ALT attribute that can play a similar role. But obviously this kind of cue box is too monotonous, for this reason someone uses JavaScript to achieve a beautiful hint box effect, this effect is commonly used in
"About modularity and why to Modularize"
Let's talk about why we want to modularize. In fact, this is related to coding ideas and the convenience of code management (no mention of namespace pollution is because I believe that the coder who has
For example
Copy Code code as follows:
settimeout (function () {alert (' Hello! ');}, 0;
SetInterval (callbackfunction, 100);
It is assumed that the greeting method in settimeout is executed immediately, because it is not a
Debugging JavaScript is probably the most depressing thing in web development. So here we are definitely looking for some good tools to help you debug. Here are 10 of our selected browser-based JS online debugging tools, I hope you like! Online
When implementing client-server interactions through JavaScript, the operating system sometimes needs to be judged to achieve compatibility under different operating systems, such as: We have a Web site that works well under Windows XP, but under
1, the original code, the inverse code, the complement, the positive subtraction to complement addition
JS in the binary operation, the use of 32-bit binary integer, because the whole number of JS is signed, the highest bit 0 for positive numbers, 1
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.