Replacing VBScript Sub with JavaScript

liunx

Guest
Here's my problem-<br />
<br />
I have a page that I have built in the past, where I have included large amounts of HTML code inside of a VBScript SUB. <br />
<br />
Example-<br />
<br />
SUB Individual_Info<br />
<br />
%><br />
<table><br />
.....<br />
<br />
</table><br />
<br />
<%<br />
end sub<br />
%><br />
<br />
The content of the sub itself makes up a very detailed report that contains both static HTML and some recordset values. Currently I have several of these subs in one page, so that I can build all my reports in one page, and any functions that I need on all of them can be built once as well (Some of the reports need dates formatted in a certain way, so I can create the dateformat function at the top of the page, and when the page is included using a server side include, so is the function I need.<br />
<br />
My root page then makes a call to the sub, and the content of that sub is then displayed in the browser.<br />
<br />
Example-<br />
<br />
MySubsPage.asp<br />
<br />
Function dateformat()<br />
function content goes here<br />
end function<br />
<br />
Sub Individual_info<br />
%><br />
sub content goes here<br />
<%<br />
end sub<br />
%><br />
<br />
MyDefaultpage.asp<br />
<br />
<!-- #include file ="mysubspage.asp" --><br />
<%<br />
Select request.querystring("report")<br />
case "Info"<br />
call individual_info<br />
Case ....<br />
<br />
end select<br />
%><br />
<br />
<br />
<br />
<br />
This way, I can keep adding reports to mysubspage, and just make the calls as I need them from the other page. And I don't need to recreate or include the functions (like dateformat) that I will need on these reports on each individual page.<br />
<br />
The problem is that the sub is a VBScript action, and I need to convert all of this over to Javascript in case we port the site away from IIS. <br />
<br />
Can this be done, or will my subs have 60 Million document.write commands in them now. I am just not sure how the server will parse it all out with it as JavaScript, so I wanted to ask.<!--content-->well, this really is a larger question. you mentioned 'if' we ever go away from IIS. If you go away from IIS, you might not be using ASP at all... and would have to consider your options. <br />
<br />
ASP for linux is not as robust as ASP for windows.... so there are considerations there. <br />
<br />
Using vbscript for ASP is pretty similar to using server side JS for ASP. Of course some things change as so on. If your converting your vbscripts to jscripts... you have a lot of work cut out for you. I really don't see the advantage of doing all that rewriting... since 'if' you change platforms... your going to have a lot of other things changing too.<!--content-->There is Server-Side Javascript just as there's Server-Side VBScript. You can code ASP in Javascript, although the default is VBScript.<br />
Just as VBScript has Sub routines, Javascript has functions.<br />
Is that all you wanted to know? The bottom line is - yes - you can convert VBScript into Javascript at the server. But as Doc pointed out, you need to know which server you're going to migrate to. There's no advantage in converting your VBScript into Javascript without knowing the final destination. Your new server may be just as unable to process Server-Side Javascript as Server-Side VBScript.<!--content-->After talking to my boss, the only direction we might be going with the server issue is to convert from say Commerce Server to Oracle IAS. The problem is that I believe the Oracle IAS will only run on the apache server that comes installed with Oracle 9i. (I don't know for sure and need to check on that)<br />
<br />
The concern was how will apache or IAS handle the VBScript. <br />
<br />
The decision was to leave all server side script in VBScript as we have already started in that direciton, and personally feel it's easier. We are just going to make sure the client side is Javascript, which is easier to ensure meets cross-browser requirements.<br />
<br />
Thanks for all your help.<!--content-->Apache will not run VBscript as that is Microsoft technology only. you could run chilisoft (ASP on Apache) but it is not recommended. your best bet would to run php, cgi and/or client-side javascript.<br />
<br />
I don't know about IAS..<!--content-->
 
Back
Top