By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,624 Members | 1,765 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,624 IT Pros & Developers. It's quick & easy.

set a asp variable with a value in Javascript

P: n/a
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.
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Picco" <cr******@aol.com> wrote in message
news:93*************************@posting.google.co m...
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;
Jul 23 '05 #2

P: n/a
> 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.

Jul 23 '05 #3

P: n/a
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???

Jul 23 '05 #4

P: n/a
In article <11*********************@z14g2000cwz.googlegroups. com>,
cr******@aol.com enlightened us with...
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.

--
--
~kaeli~
Time flies like an arrow. Fruit flies like a banana.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5

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

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.