PDA

View Full Version : set a asp variable with a value in Javascript


crmpicco
03-09-2005, 02:04 PM
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.

ghell
03-09-2005, 03:53 PM
javascript is client side
asp is serverside

you can only pass data to serverside if you refresh the page (send a form, querystring or store in a cookie etc)

i cant think what "acrobat stuff" you would be doing appart from redirecting anyway (but then i dont use PDFs)


edit: is there anything in the Request.ServerVariables that would say if acrobat was enabled?

glenngv
03-10-2005, 02:52 AM
This is related to your other thread (http://www.codingforums.com/showthread.php?t=53972) that I helped you the other day. As I said in that thread, you need a separate page (static html will do as server-side code is unnecessary) that will detect the Acrobat plugin in the client-side and just redirect to the pdf file if the plugin exists.

ghell
03-10-2005, 03:56 PM
i cant think what "acrobat stuff" you would be doing appart from redirecting anyway (but then i dont use PDFs)

thats what i meant :)