Created
June 20, 2016 08:55
-
-
Save imchao9/7bae93b020a4ac835ef92c40d426e5f1 to your computer and use it in GitHub Desktop.
递归遍历对象属性
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function TraversalObject(obj) { | |
| for (var a in obj) { | |
| if (typeof (obj[a]) == "object") { | |
| TraversalObject(obj[a]); //递归遍历 | |
| } else { | |
| var RegUrl = new RegExp(); | |
| RegUrl.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); | |
| if (RegUrl.test(obj[a])) { | |
| fileDownload.push(obj[a]); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment