Raxan HTML Object Quick Reference


The html object is the main Javascript object that contains the methods and properies used by the Raxan Framework.

Methods/Events Description Example
version Return the version number of the framework alert(html.version);
path Path to framework files. This will be detected by default.

To manually set the library path use:

html.path = './raxan-changes';

csspath Path to Raxan sylesheets. This will be detected by default.

To manually set the css path use:

html.csspath = './mystyles';

pluginpath Path to Raxan plugins. This will be detected by default.

To manually set the plugins path path use:

html.pluginpath = './myplugins';

mainScript Returns the name of the main startup or code-behind script. If multiple startup scripts were specified then this property will return an array. alert(html.mainScript)
Methods
bind(css,evt,fn)

Bind the event of an html element to a function.

  • css - Element selector
  • evt - Name of event
  • fn - Callback function

html.bind("#btnsave", "click", function(){
alert("You have clicked me");
});

css(src,extrn)

Dynamically load a stylesheet from the server.

  • src - Stylesheet URL.
  • extrn - Set to true when loadig styles that are not located inside styles folder.
html.include("master");
html.include("name-of-theme/theme");

// for other stylesheets
html.include("path/to/folder/stylesheet.css", true);

include(src,extrn,fn)

Dynamically load a Javascript from the server.

  • src - Javscript URL.
  • extrn - Set to true when loadig styles that are not located inside plugins folder.
  • fn - Calback function to receive notification after the file has loaded.
html.include("myplugin");
html.include("namespace/myplugin");
html.include("path/to/folder/myscript.js", true);
html.include("path/to/folder/myscript.js", true, function(){
alert("File loaded successfully");
});

urlparams() Returns an array containing url parameters passed to the page. var url = html.urlparams();
alert(url['name']);

filename() Returns the web page file
alert(html.filename());

post(url, data) Post data to the server.
  • url - URL to post data.
  • data - hash array containing data to be sent to the web server.
var data = {
name:"value1",
name2: "value2"
}
// send data to server
html.post("save.php",data);

log(txt) Log text to window.console or display in status bar. The window.console is used if Firebug is enabled.

Events    
ready(fn) Bind a function to the ready event. This event is triggered when the DOM has be loaded and can be manipulated.

html.ready(function(){
alert("The DOM is ready");
});
load(fn) Bind a function to the browser's onload event.
unload(fn) Bind a function to the browser's unload event.