Click here to Skip to main content
15,880,725 members
Articles / Web Development / XHTML

ensure - Ensure JavaScripts/HTML/CSS are loaded on-demand when needed

Rate me:
Please Sign up or sign in to vote.
4.97/5 (22 votes)
9 Jun 2008CPOL8 min read 150.5K   610   91  
A tiny JavaScript library that provides a handy function "ensure" which allows you to load JavaScript, HTML, CSS on-demand and then execute your code. ensure ensures that relevant JavaScript and HTML snippets are already in the browser DOM before executing your code that uses them.
<div id="blockUI" style="display: none; background-color: black; width: 100%; height: 100px; position: absolute; left: 0px; top: 0px; z-index: 50000; -moz-opacity: 0.5; opacity: 0.5; filter: alpha(opacity=50);" onclick="return false" onmousedown="return false" onmousemove="return false" onmouseup="return false" ondblclick="return false">&nbsp;</div>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect BT, UK (ex British Telecom)
United Kingdom United Kingdom

Comments and Discussions