Print Page | Close Window

.js to .asp

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=23418
Printed Date: 29 March 2026 at 10:24am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: .js to .asp
Posted By: suedechaser
Subject: .js to .asp
Date Posted: 28 May 2007 at 6:55am
Hi all,

I hope I can get some help on this on one please.

I have an existing javascript file ( scripts.js ) that I wish to convert to an asp include file instead of the traditional
<script language="javascript" src="includes/default_javascript.js"></script>

I do require this page to use the WWf commom.asp, so I cannot use <@Language = Javascript> to run the javascript.

Here is a sample of the code straight fron the javascript file:

function createAjaxObj(){
     var httprequest=false
     if (window.XMLHttpRequest){ // if Mozilla, Safari etc
     httprequest=new XMLHttpRequest()
     if (httprequest.overrideMimeType)
     httprequest.overrideMimeType('text/xml')
     }
     else if (window.ActiveXObject){ // if IE
     try {
     httprequest=new ActiveXObject("Msxml2.XMLHTTP");
     }
     catch (e){
     try{
     httprequest=new ActiveXObject("Microsoft.XMLHTTP");
     }
     catch (e){}
     }
     }
     return httprequest
     }


and another...



function rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, logicswitch){
this.RSS_id=RSS_id //Array key
this.cachetime=cachetime //Time
this.tickerid=divId //ID
this.delay=delay //Delay
this.logicswitch=(typeof logicswitch!="undefined")? logicswitch : ""
this.mouseoverBol=0 //Boolean
this.pointer=0
this.opacitysetting=0.2 //Opacity this.title=[], this.link=[], this.description=[], this.pubdate=[] //Arrays to hold each component of an RSS item
this.ajaxobj=createAjaxObj()
document.write('<div id="'+divId+'" class="'+divClass+'" >load...</div>')
if (window.getComputedStyle) //detect if moz-opacity is defined in external CSS for specified class
this.mozopacityisdefined=(window.getComputedStyle(document.getElementById(this.tickerid), "").getPropertyValue("-moz-opacity")==1)? 0 : 1
this.getAjaxcontent()
}


Please someone, I have tried many different ways to get this to work and am just about at wits end....

Can anyone please offer some hints on changing javascript functions into asp functions.

king regards

suede




Replies:
Posted By: KCWebMonkey
Date Posted: 29 May 2007 at 4:29am

you can include the contents of any file using SSI (server side includes).

just take your javascript code, wrap it in a script tag, save the file as javascript.inc (for example) and then use the following to include it:
 

<!-- #include virtual ="/includes/javascript.inc" -->



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net