473,465 Members | 4,818 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to get variable from ASP file to html file

Hi

I have a HTML-only file, and asp file that do a databasequery.

How can I do a query in the html file, like this: DBLookup("2").
The asp file execute the query and respond with the result. Send it back to
the htmlfile
and put it were the "DBLookup("2")" is.

I can not have any asp code in the html page.

I have a php file that works like this, but how can I do the same with asp??

You can find the phpcode here:
http://www.phpjunkyard.com/php-click-counter.php

// Peter
Sep 23 '06 #1
8 2256
Peter Gustafsson wrote on 23 sep 2006 in
microsoft.public.inetserver.asp.general:
I have a HTML-only file, and asp file that do a databasequery.

How can I do a query in the html file, like this: DBLookup("2").
The asp file execute the query and respond with the result. Send it
back to the htmlfile
and put it were the "DBLookup("2")" is.

I can not have any asp code in the html page.
Why would you want to do that, Peter?

There are lot's of ways, but the rationale of not changing the html file
to an asp file escapes me.

====

You could use clientside script.

You could order IIS to read a .html as a asp exention.

You could write a serverside .html file with filesysemobject.

You could use an <iframein yourr html page havin an .asp src.

etc.

====

Using an asp file however makes it simple:

<h1>This is the value: <% = myASpVariable %></h1>

I have a php file that works like this, but how can I do the same with
asp??

You can find the phpcode here:
http://www.phpjunkyard.com/php-click-counter.php
I do not see there what you specify, but then, I do not use php often.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 23 '06 #2
"Evertjan." <ex**************@interxnl.netskrev i meddelandet
news:Xn********************@194.109.133.242...
Peter Gustafsson wrote on 23 sep 2006 in
microsoft.public.inetserver.asp.general:
>I have a HTML-only file, and asp file that do a databasequery.

How can I do a query in the html file, like this: DBLookup("2").
The asp file execute the query and respond with the result. Send it
back to the htmlfile
and put it were the "DBLookup("2")" is.

I can not have any asp code in the html page.
Why would you want to do that, Peter?
The webserver doesn't support ASP.

There are lot's of ways, but the rationale of not changing the html file
to an asp file escapes me.

You could use clientside script.
You could order IIS to read a .html as a asp exention.
You could write a serverside .html file with filesysemobject.
You could use an <iframein yourr html page havin an .asp src.
etc.

Using an asp file however makes it simple:

<h1>This is the value: <% = myASpVariable %></h1>
I got iframe working:
<p><font face="Verdana"><iframe src="dlcounts.asp?Id=2"></iframe></font></p>
But I have no idea about the rest. and iframe doesn't look very good.
>I have a php file that works like this, but how can I do the same with
asp??

You can find the phpcode here:
http://www.phpjunkyard.com/php-click-counter.php

I do not see there what you specify, but then, I do not use php often.
There is a download link on that page.

Why so much problem to this i ASP?? It's really simple in PHP.
This is the htmlcode:

<script language="Javascript" src="http://localhost/display.php"<!-- //-->
</script>
I can then anywere in the html code access the php functions:

<font face="Verdana" size=1>
This file has been downloaded <script
language="Javascript">ccount_display('1')</script>&nbsp;times.<br>
This file has been downloaded <script
language="Javascript">ccount_display('2')</script>&nbsp;times.<br>
This file has been downloaded <script
language="Javascript">ccount_display('3')</script>&nbsp;times.<br>
</font>

// Peter
Sep 23 '06 #3
Peter Gustafsson wrote on 23 sep 2006 in
microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.netskrev i meddelandet
news:Xn********************@194.109.133.242...
>Peter Gustafsson wrote on 23 sep 2006 in
microsoft.public.inetserver.asp.general:
[...]
>>I can not have any asp code in the html page.
>Why would you want to do that, Peter?

The webserver doesn't support ASP.

>There are lot's of ways, but the rationale of not changing the html
file to an asp file escapes me.
[...]
>
I got iframe working:
<p><font face="Verdana"><iframe
src="dlcounts.asp?Id=2"></iframe></font></pBut I have no idea about
the rest. and iframe doesn't look very good.
Impossible, your site does not support ASP.

You cannot get a asp file executed on the same server if you first
correctly state it cannot be done.

>>I have a php file that works like this, but how can I do the same
with asp??

You can find the phpcode here:
http://www.phpjunkyard.com/php-click-counter.php

I do not see there what you specify, but then, I do not use php
often.

There is a download link on that page.
Why so much problem to this i ASP?? It's really simple in PHP.
This is the htmlcode:

<script language="Javascript" src="http://localhost/display.php"<!--
//--</script>
You can do that in asp as in php.
There is no difference, as you can make a js code page with both.

btw: language="Javascript" and <!-- //--are deprecated since 10 years
now.
I can then anywere in the html code access the php functions:

<font face="Verdana" size=1>
This file has been downloaded <script
language="Javascript">ccount_display('1')</script>&nbsp;times.<br>
This file has been downloaded <script
language="Javascript">ccount_display('2')</script>&nbsp;times.<br>
This file has been downloaded <script
language="Javascript">ccount_display('3')</script>&nbsp;times.<br>
</font>
These are NOT php functions, but clientside javascript functions.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 23 '06 #4
"Evertjan." <ex**************@interxnl.netskrev i meddelandet
news:Xn********************@194.109.133.242...
These are NOT php functions, but clientside javascript functions.
I know, I just just showed how the html code looked like.

This is the PHP code in display.php:

<?php
require_once "settings.php";

if($settings['system'] == 2) {$settings['newline']="\r\n";}
elseif($settings['system'] == 3) {$settings['newline']="\r";}
else {$settings['newline']="\n";}

echo "var ccount_link = new Array();\n";

$lines = file($settings['logfile']);

foreach ($lines as $thisline) {
trim($thisline);
list($id,$added,$url,$count,$linkname)=explode("%% ",$thisline);
echo "ccount_link[$id]=$count;\n";
}
echo "
function ccount_display(id)
{
document.write(ccount_link[id]);
}
";
exit();
?>

// Peter
Sep 23 '06 #5
Peter Gustafsson wrote on 23 sep 2006 in
microsoft.public.inetserver.asp.general:
>"Evertjan." <ex**************@interxnl.netskrev i meddelandet
news:Xn********************@194.109.133.242...
These are NOT php functions, but clientside javascript functions.

I know, I just just showed how the html code looked like.
So the requested asp cod is on another server?
This is the PHP code in display.php:

<?php
require_once "settings.php";
[...]
?>
As far as I can see, the php just makes an js code that can be executed
clientside and contains an array, but my php knowledge is not that good.

Let me give you an ASP example:
========== myJS.asp on server1 ===========
<%
a = "Hello"
b = "world"
c = "!"
d = session("myName")
%>
var myArray = [<%=a%>,<%=b%>,<%=c%>,<%=d%>]
===========================================
======= myExample.html on server2 without asp ===========
<head>
<script type='text/javascript' src='http:/server1.com/myJS.asp'></script>
</head>
<body>
This is the text:
"<script type='text/javascript'>
document.write(myArray(0)+' '+myArray(1)+myArray(2))
</script>"
<br>
Yours truly,
<br>
<script type='text/javascript'>
document.write(myArray(3))
</script>.
</body>
</html>
============================================

NOT tested.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 23 '06 #6

"Peter Gustafsson" <sm5tri@NO_SPAM_passagen.sewrote in message
news:eL**************@TK2MSFTNGP02.phx.gbl...
Hi

I have a HTML-only file, and asp file that do a databasequery.

How can I do a query in the html file, like this: DBLookup("2").
The asp file execute the query and respond with the result. Send it back
to
the htmlfile
and put it were the "DBLookup("2")" is.

I can not have any asp code in the html page.

I have a php file that works like this, but how can I do the same with
asp??
>
You can find the phpcode here:
http://www.phpjunkyard.com/php-click-counter.php

// Peter

Can your HTML include Javascript? If so then perhaps the XMLHTTP object is
what you need to make a call the to the ASP page that will do the
DBLookup("2") for you.

Sep 23 '06 #7

"Anthony Jones" <An*@yadayadayada.comskrev i meddelandet
news:eQ****************@TK2MSFTNGP03.phx.gbl...
>
"Peter Gustafsson" <sm5tri@NO_SPAM_passagen.sewrote in message
news:eL**************@TK2MSFTNGP02.phx.gbl...
>Hi

I have a HTML-only file, and asp file that do a databasequery.

How can I do a query in the html file, like this: DBLookup("2").
The asp file execute the query and respond with the result. Send it back
to
>the htmlfile
and put it were the "DBLookup("2")" is.

I can not have any asp code in the html page.

I have a php file that works like this, but how can I do the same with
asp??
>>
You can find the phpcode here:
http://www.phpjunkyard.com/php-click-counter.php

// Peter


Can your HTML include Javascript? If so then perhaps the XMLHTTP object
is
what you need to make a call the to the ASP page that will do the
DBLookup("2") for you.
Hi!

Yes, javascript is OK to use, it's run at clientside. XMLHTTP was something
new to me.
But is it supported by all webbrowsers?

Do you have any example?

// Peter
Sep 24 '06 #8

"Peter Gustafsson" <sm5tri@NO_SPAM_passagen.sewrote in message
news:Od**************@TK2MSFTNGP03.phx.gbl...
>
"Anthony Jones" <An*@yadayadayada.comskrev i meddelandet
news:eQ****************@TK2MSFTNGP03.phx.gbl...

"Peter Gustafsson" <sm5tri@NO_SPAM_passagen.sewrote in message
news:eL**************@TK2MSFTNGP02.phx.gbl...
Hi

I have a HTML-only file, and asp file that do a databasequery.

How can I do a query in the html file, like this: DBLookup("2").
The asp file execute the query and respond with the result. Send it
back
to
the htmlfile
and put it were the "DBLookup("2")" is.

I can not have any asp code in the html page.

I have a php file that works like this, but how can I do the same with
asp??
>
You can find the phpcode here:
http://www.phpjunkyard.com/php-click-counter.php

// Peter

Can your HTML include Javascript? If so then perhaps the XMLHTTP object
is
what you need to make a call the to the ASP page that will do the
DBLookup("2") for you.

Hi!

Yes, javascript is OK to use, it's run at clientside. XMLHTTP was
something
new to me.
But is it supported by all webbrowsers?

Do you have any example?
Most modern browsers support a form of the XMLHTTPRequest object, I use this
function which works for IE6 and FF:-

function getHTTP()
{

if (window.XMLHttpRequest)
return new XMLHttpRequest()
else
return new ActiveXObject("MSXML2.XMLHTTP.3.0")

}

To fetch something from ASP use:-

function dbLookup(value)
{

if (value == null) value = ''

var oXH = getHTTP()

oXH.Open("GET", "http://asphost.domain.com/dblookup.asp?value=" + value,
False)
oXH.Send()
if (oXH.status == 200)
return oXH.responseText
else
throw "Fetching " + value + " failed"

}

dblookup.asp

<!-- #include virtual="/YourCodeThatImplementsDBLookup.asp" -->
<%
Dim Value : Value = CLng(Request.QueryString("value"))
Response.Write DBLooup(Value)
%>
Anthony.
// Peter


Sep 24 '06 #9

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

Similar topics

0
by: asim | last post by:
Hi All i m transforming a simple XSL file on Server side using MSXML Parser ... and writting resultant HTML directly on browser .. is there any way to get this HTML in a variable ??? i seen the...
3
by: Geoff Winsor | last post by:
Hi, I am experiencing a problem with recalling a session variable which stores whether a person is logged in to a "members only" section of a website. This area of the site has been working...
1
by: Hose B | last post by:
HI all, I have a legacy app in which users can pick various page templates. There is a template preview dialog. It works such that they view a list of icons in an asp page that represent each...
2
by: simon | last post by:
hello, what i'm looking to do is store the path of the app on a the server for reuse in the site. my thoughts so far are... -make a key in the web.config file -retrieve the value in globals.asax...
1
by: amit | last post by:
Hello Group, Does anybody know how I can have a global variable in an HTML file? for instance, I have a fuction (called aFunction() here) and during a mousedown or up event the function is going...
6
by: John Kotuby | last post by:
Hi all, I am using a 3rd party program in a VS2005 web project. The tool takes as input a string containing HTML and converts it to RTF. I have been creating a page by dynamically loading...
6
by: j.woodcock | last post by:
is there a way of having a file that's name is a variable (eg dependant on the user name) act like a include. i know that you cant define the file for an include asp tag using a variable and that...
3
by: leonardodiserpierodavinci | last post by:
Hi. Sorry for what is perhaps a neophyte question: is it possible to pass a variable to a PHP script from inside another PHP piece of code? For instance, the file test.php (which of course...
16
by: John U. | last post by:
Hi Group, Here is a common problem: I have many (100) links on a web page, all pointing to different pages on the same domain (e.g., "http:// www.x12345.com/"). This is a bother because (1)...
2
by: neeebs | last post by:
Hi, I'm not sure if this is a javascript problem per se, but here goes. I have an xsl document with a python function defined within a <script> block. Elsewhere in the xsl file, within a python...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.