Results 1 to 2 of 2

Thread: Ajax Tabs Content script

  1. #1
    Join Date
    Jun 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ajax Tabs Content script

    http://www.dynamicdrive.com/dynamici...axtabscontent/

    Hello,
    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,
    Jim
    jbsornig

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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*):

    Code:
    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=document.createElement('script')
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", file);
    }
    else if (file.indexOf(".css")!=-1){ //If object is a css file
    fileref=document.createElement("link")
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", file);
    }
    }
    if (fileref!=""){
    document.getElementsByTagName("head").item(0).appendChild(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:

    Code:
    else if (file.indexOf(".vbs")!=-1){ //If object is a vbs file
    fileref=document.createElement('script')
    fileref.setAttribute("type","text/vbscript");
    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">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •