473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Convert ASP to JavaScript and run from CD

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%>&sg max=<%=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%>&sg max=<%=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%>&sg max=<%=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%>&sg max=<%=int_sgmax%>&i=<%=x%>&imax1=<%=int_imax1%>&i max2=<%=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%>&sg max=<%=int_sgmax%>&i=<%=x%>&imax1=<%=int_imax1%>&i max2=<%=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%>&sg max=<%=int_sgmax%>&i=<%=x%>&imax1=<%=int_imax1%>&i max2=<%=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%>&sg max=<%=int_sgmax%>&i=<%=x%>&imax1=<%=int_imax1%>&i max2=<%=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>

Jul 23 '05 #1
5 2209
you may want to look at creating 'hta' applications.
look here for more info
http://members.aol.com/nickjc67/weblicat.htm


Jul 23 '05 #2
>> you may want to look at creating 'hta' applications.
look here for more info
http://members.aol.com/nickjc67/weblicat.htm


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.

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #3
In article <1f************@news.uswest.net>, mr*************@hotmail.com
enlightened us with...
you may want to look at creating 'hta' applications.
look here for more info
http://members.aol.com/nickjc67/weblicat.htm


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

Jul 23 '05 #4
Carl Gilbert wrote:
you may want to look at creating 'hta' applications.
look here for more info
http://members.aol.com/nickjc67/weblicat.htm

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.
--
Fred
Jul 23 '05 #5

"Carl Gilbert" <mr*************@hotmail.com> wrote in message
news:1f************@news.uswest.net...
you may want to look at creating 'hta' applications.
look here for more info
http://members.aol.com/nickjc67/weblicat.htm


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.
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
9
by: mprocopio | last post by:
Fellow JavaScripters, I am looking for code or implementation ideas for converting an integer variable to a four-byte array. I'm porting some of my code from C#, where I make use of their...
4
by: CSharpener | last post by:
This should be *so* easy! How do I convert a Byte or int to a binary string representation in C# In JavaScript, it goes like this for an int: javascript:(123).toString(2 or...
3
by: rishabhshrivastava | last post by:
Hello All, How can I convert a value to Double in JavaScript??? In vbscript i believe its done as cDbl(Value) I tried lots of way but getting a value of "NaN". Any suggestions/ideas will...
3
by: vunet.us | last post by:
What is the best method to convert milliseconds (after midnight January 1, 1970 GMT) to formatted time example: 972798180000 ==10/18/2000 14:08:11
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does 1+1 equal 11? or How do I convert a string to a number?...
2
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does 1+1 equal 11? or How do I convert a string to a number?...
9
by: _Who | last post by:
I have a .htm file that shows in an iframe which is part of a master's asp:Content. I need the .htm to copy the style class from the master or set it as shown below. Below is how I set the...
2
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does 1+1 equal 11? or How do I convert a string to a number?...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.