can be freely added, changed, and deleted. Therefore, it is very convenient to expand an object. A simple extension method is implemented in this way.
function extend (destination,source){ for (var property in source) destination[property] = source[property]; return destination; }
However, the old version of IE has a problem here. it thinks that the prototype method like the Object should not be traversed, so the for in loop cannot traverse the attribute names of valueOf and toS
Here, we recommend a commonly used javascript function encapsulated by you. basically, common operations are included. if you need it, take it directly. These are all common functions, so there will be no more nonsense here. let's take a look.
Code:
The code is as follows:
// CookieFunction setCookie (name, value, iDay){If (iDay! = False){Var oDate = new Date ();ODate. setDate (oDate. getDate () + iDay );Document. cookie = name + '=' + value + '; expires =' + oDate + '; path = /';}Else{Docume
Are some commonly used functions, there is no more nonsense, small partners to see their own understanding
The code:
Copy Code code as follows:
Cookies
function Setcookie (name, value, Iday)
{
if (Iday!==false)
{
var odate=new Date ();
Odate.setdate (Odate.getdate () +iday);
document.cookie=name+ ' = ' +value+ '; expires= ' +odate+ ';p ath=/';
}
Else
{
document.cookie=name+ ' = ' +value;
}
}
function GetCookie (name)
{
var arr=document.cookie.split ('; ');
var i=0;
can be freely added, changed, and deleted. Therefore, it is very convenient to expand an object. A simple extension method is implemented in this way.
function extend (destination,source){ for (var property in source) destination[property] = source[property]; return destination; }
However, the old version of IE has a problem here. It thinks that the prototype method like the Object should not be traversed, so the for in loop cannot traverse the attribute names of valueOf and toS
Here, we recommend a commonly used javascript function encapsulated by you. Basically, common operations are included. If you need it, take it directly. These are all common functions, so there will be no more nonsense here. Let's take a look.
Code:
The Code is as follows:
// CookieFunction setCookie (name, value, iDay){If (iDay! = False){Var oDate = new Date ();ODate. setDate (oDate. getDate () + iDay );Document. cookie = name + '=' + value + '; expires =' + oDate + '; path = /';}Else{Docume
Share your own encapsulated common javascript Functions and encapsulate javascript Functions
These are all common functions, so there will be no more nonsense here. Let's take a look.
Code:
Copy codeThe Code is as follows:// CookieFunction setCookie (name, value, iDay){If (iDay! = False){Var oDate = new Date ();ODate. setDate (oDate. getDate () + iDay );Document. cookie = name + '=' + value + '; expires =' + oDate + '; path = /';}Else{Document. cookie = name + '=' + value;}}Function getCookie (n
based on comments from everyone, this version has made many improvements, such as optimization of annotation extraction, support for script tags, and real-time testing.
// Dom. abut V2 (annotations-based unit testing by situ zhengmei) // http://www.cnblogs.com/rubylouvre/archive/2010/11/08/1868638.html (function () {// ecma262 new extension if (! Object. keys) {VaR _ dontenum = ['propertyisenumerable', 'isprototypeof ', 'hasownproperties', 'tolocalstring', 'string', 'value', 'constructor']; for
Backup a useful tool class. typeutilIts typetostring (string scope, object OBJ) method adopts the reflect mechanism of Java to print the content of any object.This is very useful for debugging programs.Usage:If you have an object (such as testclassobject) and want to print its content, you can use the following method:System. Out. println (typeutil. typetostring ("yourclassobjectname", testclassobject ));This method is useful for debugging the EJB pro
compile programs? This ......):
CL/C main. c
/C tells Cl to compile only source files without links. Because/ml is the default option, the preceding command is equivalent to Cl/C/ml main. C. If there is no problem (it's the best thing to do if something goes wrong! Of course, unless your environment variables are not set, you should find the vcvars32.bat file in the bin directory of VC and run it .), A main. OBJ file will appear in the current di
Copy codeThe Code is as follows:/// ---------------- Author Teng -------------// Verify whether it is nullFunction check_blank (obj, obj_name ){If (obj. value! = ''){Return true;} Else {Alert (obj_name + "cannot be blank! ");Obj. value = "";Return false;}}// Filter the length of input charactersFunction check_str_len (name, o
Thumbnail feature features:
1, the introduction of a variety of picture formats, the current support bmp,jpg,gif and so on.
2, output JPG format thumbnails, custom output compression parameters
3, efficient production of thumbnails, 4 kinds of export methods, convenient and flexible.
4, the picture cuts the function, the custom cuts the area.
5, can buy to get picture size.
6, the support text watermark, can customize the font, color, rotation angle and so on.
7, support picture watermark, pictu
function");
}
var obj = {
foo:function () {
console.log (' foo ');
}
}
Advice (Obj.foo)
Results:
Before functionFooAfter functionHaha, too simple, it is not possible to go back to sleep ....
But, is it a bit too rough .... A good surround .... At least the next call to Obj.foo should also be the result, not a dry "foo"; for this I need to make a change and use the closure
Advice = function (Originalfunc) {return
function () {
cons
. Animated GIF can be generated
The non-registered version is limited as follows:
1. You can only use up to 8 colors, but I think it's not a limit for most people,
Oh
2. The maximum graphic size that can be generated is 320x240
If it is a registered version:
13. Available to modify existing GIF, JPEG, and BMP files online
14. Customizable palette
15. Loop-screened GIF animation
Example program:
Examples of VBScript:
Set Obj=createobject ("Shotgraph
Object using the Object
Var obj = new Object ();Obj. id = '001 ';Obj. name = 'My name is obj ';Obj. teststring = 'test obj ';Obj. sayHello = function (){Console. log ('Id: '+ this. id
After studying javascript in depth recently, some individuals will: Object-oriented programming is efficient and flexible, and it is now the only programming method that can make code more robust. If we leave out those mysterious ideas such as abstract classes, my own understanding of object-oriented programming is reuse and encapsulation. Reuse is to minimize repeated code writing. encapsulation is to put some logic with high coupling into a program block, and try to prevent the content from be
Object. The Code is as follows:
// Directly use the Object to create the Object var obj = new Object (); obj. id = '001'; obj. name = 'My name is obj '; obj. teststring = 'test obj '; obj
translated from: http://zonble.net/archives/2010_09/1385.phpWhen writing JavaScript, you can use an object called window, like we want to jump from the current page to another page, we will change the location of the window.location.href, in our Objective C code, If we can get the specified WebView indicator, we can get the window object that appears in JavaScript, that is, [WebView Windowscriptobject]. This object is the bridge between JS in WebView and our
Original post address: http://hym131690.blog.163.com/blog/static/642553162009212104926450/
I recently want to learn about network programming, and most socket programming environments are UNIX, which is inconvenient and cannot be compiled in windows. I find an article to solve this problem. Cool and cool!
Linking... server. OBJ: Error lnk2001: unresolved external symbol _ imp _ Send @ 16
Server. OBJ: Error
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.