Convert ASP to JavaScript and run from CD

C

Carl Gilbert

Hi

I have some ASP code that I want to run from CD within a VB.NET windows
application with a web browser control.

However, to get the ASP pages to run without a server is proving quite
difficult. I was thinking of converting the pages to use JavaScript but I
know virtually no JavaScript and just wanted to check if what I want to
achieve is possible before making any changes.

The pages make up a portfolio that I plan to put onto CD. It consists of a
series of pages with thumbnails. A thumbnail will either link off to
another page with thumbnails, display an image or play a movie.

I am mainly using loops to display the thumbnails and build up a URL to link
off to the apprioparte image. I have attached my main page at the bottom of
this post that uses the query string to build the page.
The page is linked to using URLs as follows:
<A href="ShowImage.asp?g=2&sg=1&sgmax=2&i=0&imax1=28&imax2=28">
<A href="ShowImage.asp?g=3&sg=1&sgmax=2&i=0&imax1=28&imax2=28">
<A href="ShowImage.asp?g=4&sg=1&sgmax=1&i=0&imax1=14&imax2=0">

These state the group number, then the sub group number, then how many sub
groups there are, next the image number and then the number of images in
each sub group.
The main page then test the image number. If its zero then it will show
thumbnails, if its greater than zero it will show the appropriate image.
There is also some additional code to show/hide next and previous buttons to
allow the user to navigate through the images.

So I would like to know if a similar thing is possible with JavaScript and
if I will be able to get the pages to run from CD within a Windows app with
a web browser control. Also any help on how to actually convert the code
would be greatly appreciated.

Regards, Carl Gilbert



--------------------------------------
CODE --------------------------------------


<%

spacer = "images\misc\spacer.gif"
filler = "images\misc\filler.gif"
line_end = "images\misc\line_end.gif"
btn_previous = "images\misc\previous.gif"
btn_next = "images\misc\next.gif"
btn_contents = "images\misc\contents.gif"
btn_summary = "images\misc\summary.gif"


int_g = request.QueryString("g")
int_sg = request.QueryString("sg")
int_sgmax = request.QueryString("sgmax")
int_i = request.QueryString("i")
int_imax1 = request.QueryString("imax1")
int_imax2 = request.QueryString("imax2")

int_g = CInt(int_g)
int_sg = CInt(int_sg)
int_sgmax = CInt(int_sgmax)
int_i = CInt(int_i)
int_imax1 = CInt(int_imax1)
int_imax2 = CInt(int_imax2)

'set the max number of images based on the sub group
If int_sg = 1 Then
int_mymax = int_imax1
Else
int_mymax = int_imax2
End If

'b1 = previous
'b2 = next
'b3 = contents
'b4 = summary

If int_i = 0 Then
'we are dealing with a group

'set the previous button
If int_sg > 1 Then b1 = 80 Else b1 = 0

'set the next button
If Not int_sg = int_sgmax Then s1 = 10 Else s1 = 0
If Not int_sg = int_sgmax Then b2 = 80 Else b2 = 0

Else
'We are dealing with an image

'set the previous button
If int_i > 1 Then b1 = 80 Else b1 = 0

'set the next button
If Not int_i = int_mymax Then s1 = 10 Else s1 = 0
If Not int_i = int_mymax Then b2 = 80 Else b2 = 0

End If

'set the contents button
If Not int_i = 0 Then s2 = 10 Else s2 = 0
If Not int_i = 0 Then b3 = 80 Else b3 = 0

'set the summary button
If Not int_g = 0 Then s3 = 10 Else s3 = 0
If Not int_g = 0 Then b4 = 80 Else b4 = 0

h1 = 620 - (b1+s1+b2+s2+b3+s3+b4)

%>

<HTML>
<HEAD>
<TITLE>ShowImage</TITLE>
<META name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<META name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<META name=vs_defaultClientScript content="JavaScript">
<META name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie3-2nav3-0">
</HEAD>
<BODY ms_positioning="FlowLayout">

<FORM id="Form1" method="post" runat="server">


<TABLE width="100%" height="100%" border="0" cellspacing="0"
cellpadding="0" id="Table1">
<TR>
<TD>
<% If int_i = 0 Then %>

<TABLE width="800" height="533" border="0" align="center"
cellpadding="0" cellspacing="0" id="Table2" STYLE="border: 2 ridge
#800000">

<% Else %>

<TABLE width="800" height="533" border="0" align="center"
cellpadding="0" cellspacing="0" id="Table3" STYLE="background-image:
url(images\bulk\g<%=int_g%>sg<%=int_sg%>i<%=int_i%>.jpg); border: 2 ridge
#800000">

<% End If %>
<TR>
<TD><IMG src="<%=spacer%>" height="61" width="90"></TD>
<TD valign=bottom>
<IMG src="images\misc\port.gif" height="25" width="130">
</TD>
</TD>
<TD><IMG src="<%=spacer%>" height="61" width="90"></TD>
</TR>

<!-- DIVIDER LINE -->
<TR>
<TD height="1"></TD>
<TD><TABLE border="0" cellpadding="0" cellspacing="0" height="1">
<TR>
<TD height="1"><IMG src="<%=line_end%>" height="5" width="1"></TD>
<TD height="1"><IMG src="<%=filler%>" height="5" width="618"></TD>
<TD height="1"><IMG src="<%=line_end%>" height="5" width="1"></TD>
</TR>
</TABLE></TD>
<TD height="1"></TD>
</TR>

<!-- BUTTON ROW -->

<TR>
<TD><IMG src="<%=spacer%>" height="56" width="90"></TD>
<TD><TABLE width="620" height="56" border="0" cellpadding="0"
cellspacing="0">
<TD valign=top width=<%=h1%>>
<SPAN style='font-size:14.0pt;font-family:"Courier New"'>

<%If int_g = 1 Then %>
modelmaking
<%Else%>
artwork
<%End If%>

<I>#<%=int_sg%></I>

</SPAN>
</TD>

<!-- PREVIOUS -------------------------------------------->
<TD valign=middle>
<% If Not Clng(b1)=0 Then%>

<% If int_i = 0 Then
'Test to see if we are showing images or thumbs to put the correct
link in the button
%>
<A href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg -
1%>&sgmax=<%=int_sgmax%>&i=0&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>">
<!--Thumb link-->
<IMG src="<%=btn_previous%>" height="30" width="80" border="0">
</A>
<% Else %>
<A
href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg%>&sgmax=<%=int_sgmax%>&i=<%=int_i
- 1%>&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>"> <!--Image link-->
<IMG src="<%=btn_previous%>" height="30" width="80" border="0">
</A>
<%End If %>

<%End If%>
</TD>

<% If Not Clng(s1)=0 Then%>
<TD><IMG src="<%=spacer%>" height="30" width="10"></TD>
<%End If%>

<!-- NEXT -------------------------------------------->
<TD valign=middle>
<% If Not Clng(b2)=0 Then%>

<% If int_i = 0 Then
'Test to see if we are showing images or thumbs to put the correct
link in the button
%>
<A href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg +
1%>&sgmax=<%=int_sgmax%>&i=0&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>">
<!--Thumb link-->
<IMG src="<%=btn_next%>" height="30" width="80" border="0">
</A>
<% Else %>
<A
href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg%>&sgmax=<%=int_sgmax%>&i=<%=int_i
+ 1%>&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>"> <!--Image link-->
<IMG src="<%=btn_next%>" height="30" width="80" border="0">
</A>
<%End If %>

<%End If%>
</TD>

<% If Not Clng(s2)=0 Then%>
<TD><IMG src="<%=spacer%>" height="30" width="10"></TD>
<%End If%>

<!-- CONTENTS -------------------------------------------->
<TD valign=middle>
<% If Not Clng(b3)=0 Then%>
<A
href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg%>&sgmax=<%=int_sgmax%>&i=0&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>">
<IMG src="<%=btn_contents%>" height="30" width="80" border="0">
</A>
<%End If%>
</TD>

<% If Not Clng(s3)=0 Then%>
<TD><IMG src="<%=spacer%>" height="30" width="10"></TD>
<%End If%>

<!-- SUMMARY -------------------------------------------->
<TD valign=middle>
<% If Not Clng(b4)=0 Then%>
<A href="summarypage.asp">
<IMG src="<%=btn_summary%>" height="30" width="80" border="0">
</A>
<%End If%>
</TD>
</TABLE>

</TD>

<TD><IMG src="<%=spacer%>" height="56" width="90"></TD>
</TR>





<TR>
<TD><IMG src="<%=spacer%>" height="350" width="90"></TD>
<TD>


<% 'Test if int_i = 0. If so then show the thumbnails
If int_i = 0 Then %>

<!--CONTENT TABLE-->
<TABLE width="620" border="0" cellpadding="0" cellspacing="0"
id="Table4">
<TR>

<% For x = 1 To 7
If x <= int_mymax Then %>
<TD width="80" height="80">
<A
href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg%>&sgmax=<%=int_sgmax%>&i=<%=x%>&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>">
<IMG src="images\thumbs\th_g<%=int_g%>sg<%=int_sg%>i<%=x%>.jpg"
width="100%" height="100%" border="0">
</A>
</TD>
<% Else %>
<TD width="80" height="80"><IMG src="<%=spacer%>" width="100%"
height="100%" border="0"></TD>
<% End If %>
<% If Not x = 7 Then %>
<TD width="10"><IMG src="<%=spacer%>" width="10"></TD>
<% End If %>
<% Next %>

</TR>
<TR><TD height="10"><IMG src="<%=spacer%>" height="10"></TD></TR>
<TR>

<% For x = 8 To 14
If x <= int_mymax Then %>
<TD width="80" height="80">
<A
href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg%>&sgmax=<%=int_sgmax%>&i=<%=x%>&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>">
<IMG src="images\thumbs\th_g<%=int_g%>sg<%=int_sg%>i<%=x%>.jpg"
width="100%" height="100%" border="0">
</A>
</TD>
<% Else %>
<TD width="80" height="80"><IMG src="<%=spacer%>" width="100%"
height="100%" border="0"></TD>
<% End If %>
<% If Not x = 14 Then %>
<TD width="10"><IMG src="<%=spacer%>" width="10"></TD>
<% End If %>
<% Next %>

</TR>
<TR>
<TD height="10"><IMG src="<%=spacer%>" height="10"></TD>
</TR>
<TR>

<% For x = 15 To 21
If x <= int_mymax Then %>
<TD width="80" height="80">
<A
href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg%>&sgmax=<%=int_sgmax%>&i=<%=x%>&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>">
<IMG src="images\thumbs\th_g<%=int_g%>sg<%=int_sg%>i<%=x%>.jpg"
width="100%" height="100%" border="0">
</A>
</TD>
<% Else %>
<TD width="80" height="80"><IMG src="<%=spacer%>" width="100%"
height="100%" border="0"></TD>
<% End If %>
<% If Not x = 21 Then %>
<TD width="10"><IMG src="<%=spacer%>" width="10"></TD>
<% End If %>
<% Next %>

</TR>
<TR>
<TD height="10"><IMG src="<%=spacer%>" height="10"></TD>
</TR>
<TR>

<% For x = 22 To 28
If x <= int_mymax Then %>
<TD width="80" height="80">
<A
href="ShowImage.asp?g=<%=int_g%>&sg=<%=int_sg%>&sgmax=<%=int_sgmax%>&i=<%=x%>&imax1=<%=int_imax1%>&imax2=<%=int_imax2%>">
<IMG src="images\thumbs\th_g<%=int_g%>sg<%=int_sg%>i<%=x%>.jpg"
width="100%" height="100%" border="0">
</A>
</TD>
<% Else %>
<TD width="80" height="80"><IMG src="<%=spacer%>" width="100%"
height="100%" border="0"></TD>
<% End If %>
<% If Not x = 28 Then %>
<TD width="10"><IMG src="<%=spacer%>" width="10"></TD>
<% End If %>
<% Next %>

</TD>
</TR>

</TABLE>

<% End If %>




</TD>
<TD><IMG src="<%=spacer%>" height="350" width="90"></TD>
</TR>



<TR>
<TD><IMG src="<%=spacer%>" height="61" width="90"></TD>
<TD><IMG src="<%=spacer%>" height="61" width="620"></TD>
<TD><IMG src="<%=spacer%>" height="61" width="90"></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>

</FORM>
</BODY>
</HTML>
 
C

Carl Gilbert

you may want to look at creating 'hta' applications.
From what I can gather, this only allows you to place code at the
beginning of the script. Are you able to place code anywhere in the
document as with ASP? The same question applies to JavaScript.
 
K

kaeli

From what I can gather, this only allows you to place code at the
beginning of the script. Are you able to place code anywhere in the
document as with ASP? The same question applies to JavaScript.

Using an HTA, yes, you can place code anywhere in the document, just like
ASP. It looks very similar to an ASP application, actually.

--
--
~kaeli~
Synonym: the word you use in place of a word you can't
spell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
F

Fred Oz

Carl said:
From what I can gather, this only allows you to place code at the
beginning of the script. Are you able to place code anywhere in the
document as with ASP? The same question applies to JavaScript.

Yes, but note that the result will only run on Windows with IE.
 
H

Hal Rosser

Carl Gilbert said:
From what I can gather, this only allows you to place code at the
beginning of the script. Are you able to place code anywhere in the
document as with ASP? The same question applies to JavaScript.

It only works with Windows IE.
Work thru the tutorial - you'll see how it works.
Its similar to ASP. Yes, you can include JS.
If you don't like it,
then Mr Gates will be heart-broken.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top