skip to main |
skip to sidebar
RSS Feeds
ASP.NET, JavaScript, Oracle and SQL articles and code.
ASP.NET, JavaScript, Oracle and SQL articles and code.
10:49 AM
Posted by Michael Heliso
Note: Please check JavaScript Utility Functions Note.
Here is short JavaScript function which creates and returns a script node based on the string you specify as parameter:
/*Define the namespaces*/
var JavaScript = {};
JavaScript.Utils = {};
JavaScript.Utils.DOM = {};
JavaScript.Utils.DOM.CreateScriptElement = function(scriptValue) {
var node = document.createElement("script");
node.setAttribute('type', 'text/javascript');
if (node.canHaveChildren == null || node.canHaveChildren)
node.appendChild(document.createTextNode(scriptValue));
else
node.text = scriptValue;
return node;
};