Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - .js to .asp
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

.js to .asp

 Post Reply Post Reply
Author
suedechaser View Drop Down
Groupie
Groupie


Joined: 25 February 2006
Location: USA
Status: Offline
Points: 129
Post Options Post Options   Thanks (0) Thanks(0)   Quote suedechaser Quote  Post ReplyReply Direct Link To This Post Topic: .js to .asp
    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

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post 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" -->
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.