View Full Version : Ajax Tabs Content script

06-02-2006, 02:15 PM

I am using the Ajax Tabs Content script. I am pointing to an ASP page that I have some vbscripts in. I did read the js would need to be removed and included externally. Can you tell me what I would need to do to get my vbscripts running.

Thanks for any help,

06-02-2006, 09:57 PM
Most likely it could be done similarly to javascripts, here is the function from ajaxtabs.js where scripts and style are added to the top page (red parts show where javascript is tested as a loadobj type and prepared to be included on the top page. You would need a similar, tailored to vb scripts section*):

function loadobjs(revattribute){
if (revattribute!=null && revattribute!=""){ //if "rev" attribute is defined (load external .js or .css files)
var objectlist=revattribute.split(/\s*,\s*/) //split the files and store as array
for (var i=0; i<objectlist.length; i++){
var file=objectlist[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref.setAttribute("src", file);
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
if (fileref!=""){
loadedobjects+=file+" " //Remember this object as being already added to page

Incidentally, all this does is make the code available except upon the very first loading and then only if the script has a command in it that runs one of its own functions. In all likelihood, the easiest method would simply be to include the vb scripts on the top page and have the loaded content use them in the usual manner. If some part of a vb script needs to run 'onload' of the externally loaded content, then a poll should be used to determine when the content has loaded and then exited after calling the vb function. However, if the vb scripts simply need to be available to the loaded content, just having them on the top page will be all that is needed.

* I don't use vbscript but, I imagine the section could go something like so:

else if (file.indexOf(".vbs")!=-1){ //If object is a vbs file
fileref.setAttribute("src", file);

where .vbs is the customary file extension for a vbscript and text/vbscript is the customary type attribute for a vbscript. As I say, not being familiar with vbscript, I am not sure if these are the conventions ordinarily used or not. If not, simply substitute the ones that are used in a normal vb tag:

<script type="whatever goes here" src="somefile.whatever goes here">