Created
June 28, 2012 19:17
-
-
Save michaelBenin/3013308 to your computer and use it in GitHub Desktop.
This file contains 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<script type="text/javascript"> | |
function NameSpace() | |
{ | |
var e, t, n, r, i, s, o, u = arguments; | |
for (n = 0, r = u.length; n < r; n++) | |
{ | |
t = u[n].split("."), e = window[t[0]] = window[t[0]] || {}; | |
for (i = 1, s = t.length; i < s; i++) o = t[i], e = e[o] = e[o] || {} | |
} | |
return e | |
} | |
NameSpace('akn.user_info.username'); | |
window.akn.user_info.username = "MichaelBenin"; | |
var str = "Visit W3Schools email_removed"; | |
str = str.replace(/email_removed/g, window.akn.user_info.username); | |
alert(str); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
remove the namespace function and it'll break