function $package(name)
{
// Split the namespace domain string
var domains = name.split("."); var cur_domain = window; var i=0; i< domains.length; i )
{
var domain = domains[i];
//If the domain space has not been created
if(typeof(cur_domain[ domain]) == "undefined")
The current domain is the domain of this cycle
cur_domain = cur_domain[domain]; );
$package("com.hs.test");
with(com.anllin)
with(com.hs)
{
alert("system1 : " system) ;
alert("test1 : " test);
}
//Use closure reference method
$package("com.anllin.system");
$ package("com.hs.test");
(function(){
var system = com.anllin.system;
var test = com.hs.test;
alert("system2 : " system);
alert("test2" test);
})();