0
edits
Changes
Created page with 'To include JavaScript JS files in a Web Page View custom field you must utilize the following method. <pre> <script language="JavaScript"> function include_dom(script_file…'
To include JavaScript JS files in a [[Web Page View]] custom field you must utilize the following method.
<pre>
<script language="JavaScript">
function include_dom(script_filename) {
var html_doc = document.getElementsByTagName('head').item(0);
var js = document.createElement('script');
js.setAttribute('language', 'javascript');
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', script_filename);
html_doc.appendChild(js);
return false;
}
function includejsfiles() {
include_dom("/validate.js");
include_dom("/anotherfile.js");
}
</script>
</pre>
You will also have to call the ''includejsfiles'' function in the body onload:
<body onload="includejsfiles();">
[[Category:JavaScript]]
<pre>
<script language="JavaScript">
function include_dom(script_filename) {
var html_doc = document.getElementsByTagName('head').item(0);
var js = document.createElement('script');
js.setAttribute('language', 'javascript');
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', script_filename);
html_doc.appendChild(js);
return false;
}
function includejsfiles() {
include_dom("/validate.js");
include_dom("/anotherfile.js");
}
</script>
</pre>
You will also have to call the ''includejsfiles'' function in the body onload:
<body onload="includejsfiles();">
[[Category:JavaScript]]