javascript基础知识大集锦(2)
    本期主题:正则表达式 call(),apply(),callee,caller,cookie方法,setInterval(),clearInterval(),setTimeout() ,clearTimeout()
详细看附件例子,还是写的比较简单的。
1.关于cookie的函数:
- 
?
 
- 
?
 
- 
?
 
- 
?
 
- 
?
 
- 
?
 
- 
?
 
- 
?
 
- 
??
 
- 
CookieTool?=?function
(name,?value,?options)?{??
 
- 
??????????if
?(
typeof
?value?!=?
'undefined'
)?{??
 
- 
????????????????????options?=?options?||?{};??
 
- 
????????????????????if
?(value?===?
null
)?{??
 
- 
??????????????????????????????value?=?''
;???
 
- 
??????????????????????????????options.expires?=?-1;??
 
- 
????????????????????}??
 
- 
????????????????????var
?expires?=?
''
;??
 
- 
????????????????????if
?(options.expires?&&?(
typeof
?options.expires?==?
'number'
?||?options.expires.toUTCString))?{??
 
- 
??????????????????????????????var
?date;??
 
- 
??????????????????????????????if
?(
typeof
?options.expires?==?
'number'
)?{??
 
- 
????????????????????????????????????????date?=?new
?Date();??
 
- 
????????????????????????????????????????date.setTime(date.getTime()?+?(options.expires?*?24?*?60?*?60?*?1000));??
 
- 
??????????????????????????????}?else
?{??
 
- 
????????????????????????????????????????date?=?options.expires;??
 
- 
??????????????????????????????}??
 
- 
??????????????????????????????expires?=?';?expires='
?+?date.toUTCString();??
 
- 
????????????????????}??
 
- 
????????????????????var
?path?=?options.path???
';?path='
?+?(options.path)?:?
''
;??
 
- 
????????????????????var
?domain?=?options.domain???
';?domain='
?+?(options.domain)?:?
''
;??
 
- 
????????????????????var
?secure?=?options.secure???
                        
                    
 
 
                    
                    
                        免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。