set a asp variable with a value in Javascript

P

Picco

How can i set a asp variable with a value in Javascript?

JS Code:

<script language="JavaScript" type="text/javascript">
<!--

if (acrobat.ver5)
{
// if Acrobat 5.0 or newer is installed, do Acrobat 5.0 stuff.
document.write("Acrobat V5 + is installed")
var installed_pdf = "<%inst_pdf=yes%>"
}
else if (acrobat.installed)
{
// do older Acrobat stuff
document.write(acrobat.version);
}
else
{
// Acrobat is NOT installed. Do something else.
document.write("Acrobat is NOT installed.")
}

//-->
</script>

ASP Code:

<% response.write "Installed PDF = " & inst_pdf & "<br>" %>

This doesnt seem to work.
 
M

McKirahan

Picco said:
How can i set a asp variable with a value in Javascript?

JS Code:

<script language="JavaScript" type="text/javascript">
<!--

if (acrobat.ver5)
{
// if Acrobat 5.0 or newer is installed, do Acrobat 5.0 stuff.
document.write("Acrobat V5 + is installed")
var installed_pdf = "<%inst_pdf=yes%>"
}
else if (acrobat.installed)
{
// do older Acrobat stuff
document.write(acrobat.version);
}
else
{
// Acrobat is NOT installed. Do something else.
document.write("Acrobat is NOT installed.")
}

//-->
</script>

ASP Code:

<% response.write "Installed PDF = " & inst_pdf & "<br>" %>

This doesnt seem to work.

ASP executes before client-side JavaScript.

Perhaps all you want (inside your script) is:

document.write "Installed PDF = " & inst_pdf;
 
C

crmpicco

ASP executes before client-side JavaScript.
Perhaps all you want (inside your script) is:

document.write "Installed PDF = " & inst_pdf;

Can it not be done?

I've tried runat=server.

doesnt work.
 
C

crmpicco

I now have this code:

<script language="JavaScript" type="text/javascript">
if (acrobat.ver5)
{
// if Acrobat 5.0 or newer is installed, do Acrobat 5.0 stuff.
//document.write("Acrobat V5 + is installed")
}
else if (acrobat.installed)
{
// do older Acrobat stuff
//document.write(acrobat.version);
}
else
{
// Acrobat is NOT installed. Do something else.
//document.write("Acrobat is NOT installed.")
question = confirm("You do not have Adobe Acrobat Reader Installed on
your system. \n\nClick OK to download this software now. Click Cancel
to go Back")
if (question !="0"){
top.location =
'http://ardownload.adobe.com/pub/adobe/reader/win/7x/7.0/enu/AdbeRdr70_enu_full.exe'
}
if (question =="0"){
history.back()
}

}
</script>

However, if you click the 'OK' button then when the 'File Download'
dialgoue Windows box appear should you click Cancel then i am just left
with a white screen.

what i want is if cancel is clicked then return to the previous page (
a history.back) or something???
 
K

kaeli

question = confirm("You do not have Adobe Acrobat Reader Installed on
your system. \n\nClick OK to download this software now. Click Cancel
to go Back")

The confirm function returns boolean.

Better:
doInstall = confirm("Want it?");
if (doInstall)
{
// do something
}
else
{
// do something else
}
However, if you click the 'OK' button then when the 'File Download'
dialgoue Windows box appear should you click Cancel then i am just left
with a white screen.

Not much you can do about that, really, because you can't catch the click on
Cancel there.
In fact, you'll still have a blank screen once the user downloads the file,
won't you?

Why don't you simply tell the user they need to install it and provide a
link? That's what other sites do.
If you embed the document, you might be able to make the browser prompt for
the plugins. That happens with Flash. I don't do acrobat, so I'm not sure if
it's the same.

--
 
B

bruce_brodinsky

move the javascript field to a hidden form field (<input type=hidden>)
and then use Request.Form (or Request.querystring, whatever) to get it.
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top