Javascript中的var_dump函數(shù)實現(xiàn)代碼
更新時間:2009年09月07日 18:48:32 作者:
發(fā)現(xiàn)了一個非常好的JavaScript調(diào)試方法,目前看到的是可以打印Object/Array/Function/String四種類型,使用方法和PHP中的var_dump()一樣,只要直接dump(變量名)即可。
發(fā)現(xiàn)了一個非常好的JavaScript調(diào)試方法,目前看到的是可以打印Object/Array/Function/String四種類型,使用方法和PHP中的var_dump()一樣,只要直接dump(變量名)即可。
dump(value, [showTypes])
@ param value (Any) value to dump
@ param [showTypes] (Boolean) optional to display each key/value's type
@ return (Void) returns nothing
The Dump method is based on one of the tags available in Coldfusion ( <cfdump>) providing the ability to display simple and complex variables in a user friendly way that is perfect for debugging/inspecting data. There is no way to do this with javascript and often I had wanted a method to do this. This method will do just that allowing for an infinite amount of data nesting complete with color coding for different data types, the ability to show/hide the data's type (String/Number/Boolean/Object/Array/Function), expandable and collapsible tables/keys and cross browser support.
Click on the buttons bellow to see some examples in action, toggle the Show Data Types box to see javascript data typing in action (not possible in Coldfusion).
Browser Support
Internet Explorer 6, Internet Explorer 7, Firefox 1.5, Opera 8, Safari 1.2 (Mac), Firefox (Mac) - all tested, should also work in most other browsers
Dump Examples
官方網(wǎng)址
http://www.netgrow.com.au/files/javascript_dump.cfm
相關(guān)文件
http://www.netgrow.com.au/assets/files/dump/dump.zip
以防上面的地址下載不了,腳本之家本地下載地址
http://www.dbjr.com.cn/jiaoben/20804.html
復(fù)制代碼 代碼如下:
dump(value, [showTypes])
@ param value (Any) value to dump
@ param [showTypes] (Boolean) optional to display each key/value's type
@ return (Void) returns nothing
The Dump method is based on one of the tags available in Coldfusion ( <cfdump>) providing the ability to display simple and complex variables in a user friendly way that is perfect for debugging/inspecting data. There is no way to do this with javascript and often I had wanted a method to do this. This method will do just that allowing for an infinite amount of data nesting complete with color coding for different data types, the ability to show/hide the data's type (String/Number/Boolean/Object/Array/Function), expandable and collapsible tables/keys and cross browser support.
Click on the buttons bellow to see some examples in action, toggle the Show Data Types box to see javascript data typing in action (not possible in Coldfusion).
Browser Support
Internet Explorer 6, Internet Explorer 7, Firefox 1.5, Opera 8, Safari 1.2 (Mac), Firefox (Mac) - all tested, should also work in most other browsers
Dump Examples
官方網(wǎng)址
http://www.netgrow.com.au/files/javascript_dump.cfm
相關(guān)文件
http://www.netgrow.com.au/assets/files/dump/dump.zip
以防上面的地址下載不了,腳本之家本地下載地址
http://www.dbjr.com.cn/jiaoben/20804.html
您可能感興趣的文章:
- JavaScript中var關(guān)鍵字的使用詳解
- javascript定義變量時帶var與不帶var的區(qū)別分析
- javascript定義變量時加var與不加var的區(qū)別
- JavaScript中變量聲明有var和沒var的區(qū)別示例介紹
- 淺談JavaScript中定義變量時有無var聲明的區(qū)別
- javascript定義變量時有var和沒有var的區(qū)別探討
- Javascript全局變量var與不var的區(qū)別深入解析
- 在Javascript中 聲明時用"var"與不用"var"的區(qū)別
- 關(guān)于JavaScript中var聲明變量作用域的推斷
- JScript中的''var''定義變量的作用域
- JavaScript中const、var和let區(qū)別淺析
相關(guān)文章
js中回調(diào)函數(shù)的學(xué)習(xí)筆記
這篇文章主要介紹了js中回調(diào)函數(shù)的相關(guān)知識,需要的朋友可以參考下2014-07-07bootstrap fileinput 插件使用項目總結(jié)(經(jīng)驗)
這篇文章主要介紹了bootstrap fileinput 插件使用項目總結(jié),是小編日常碰到的問題及解決方法,需要的朋友可以參考下2017-02-02js中字符串編碼函數(shù)escape()、encodeURI()、encodeURIComponent()區(qū)別詳解
JavaScript中有三個可以對字符串編碼的函數(shù),分別是: escape,encodeURI,encodeURIComponent,相應(yīng)3個解碼函數(shù):unescape,decodeURI,decodeURIComponent 。接下來通過本文給大家介紹三者之家的區(qū)別,感興趣的朋友一起學(xué)習(xí)吧2016-04-04基于JS實現(xiàn)操作成功之后自動跳轉(zhuǎn)頁面
這篇文章主要介紹了基于JS實現(xiàn)操作成功之后自動跳轉(zhuǎn)頁面的相關(guān)知識,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-09-09JavaScript遞歸函數(shù)解“漢諾塔”算法代碼解析
這篇文章主要介紹了JavaScript遞歸函數(shù)解“漢諾塔”算法代碼解析,需要的朋友可以參考下2018-07-07學(xué)習(xí)JavaScript設(shè)計模式(接口)
這篇文章主要帶領(lǐng)大家學(xué)習(xí)JavaScript設(shè)計模式,其中重點介紹接口,舉例說明什么是接口,對接口進行詳細(xì)剖析,感興趣的小伙伴們可以參考一下2015-11-11符合W3C網(wǎng)頁標(biāo)準(zhǔn)的iframe標(biāo)簽的使用方法
符合W3C網(wǎng)頁標(biāo)準(zhǔn)的iframe標(biāo)簽的使用方法...2007-07-07