First, let's see how the page is called.
Copy codeThe Code is as follows: <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Strict // EN"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> neverModules Using Function-http://www.never-online.net </title>
<Meta http-equiv = "ImageToolbar" content = "no"/>
<Meta name = "author" content = "never-online, BlueDestiny"/>
<Meta name = "keywords" content = "never modules, Mozilla CSS, C #,. net, Reference, BlueDestiny, never-online"/>
<Meta name = "description" content = "javascript reference, c sharp artilces"/>
<Meta name = "creator. name" content = "never-online, BlueDestiny"/>
<Style type = "text/css" media = "all" title = "Default">
Body {
Font: 9pt "Verdana ";
}
</Style>
<Script type = "text/javascript" src = "System/system. js"> </script>
<Script type = "text/javascript">
// <! [CDATA [
Using ("System. Utils. Jsclass ");
Var jsclass = new Jsclass ();
Jsclass. toString ();
//]>
</Script>
</Head>
<Body id = "www.never-online.net">
<P align = "center"> Power By never-online </a>
</Body>
</Html>
Let's take a look at the namespace System. Utils. Jsclass.
Var System ={}; System. Utils = {};
System. Utils. Jsclass = function (){
This. name = "jsclass ";
This. functions = "Using function test .";
System. Utils. Jsclass. prototype. toString = function (){
Document. write (this. functions );
}
}
The next step is the main Using function.
Var Using = function (sNamespace, bUseCache ){
BUseCache = bUseCache === true;
Var x = !! Document. all? New ActiveXObject ("MSXML2.XMLHTTP"): new XMLHttpRequest ();
Var shortname = sNamespace. substring (sNamespace. lastIndexOf (".") + 1 );
SNamespace = sNamespace. replace (/\./g, "/") + ". js ";
X. open ("GET", sNamespace + (bUseCache? "? X = "+ Math. random ():" "), false );
X. send (null); var code = x. responseText;
Window [shortname] = window. eval (code );
}
Download this file