Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2005, 08:52 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default set a asp variable with a value in Javascript

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.


www.crmpicco.co.uk
www.milklemonadechocolate.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old March 8th, 2005, 09:10 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Crimpicco

Can you tell me about
 var installed_pdf = "<%inst_pdf=yes%>"

<%inst_pdf=yes%>???
check it may be something you are missing here

Hope this will help you


Cheers :)

vinod
 
Old March 9th, 2005, 08:49 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

This doesnt work:

<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")
    <%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.")
    <%inst_pdf='"no"'%>
}

</script>

any ideas?

www.crmpicco.co.uk
www.milklemonadechocolate.uk.tt
 
Old March 9th, 2005, 08:59 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

If Acrobat is not installed then
"Acrobat is NOT installed"
appears correctly.

If Acrobat is installed then
"Acrobat V5 + is installed"
appears correctly.

However, the setting of the variables to go with these conditions does not work.

If Acrobat IS installed i want the ASP variable inst_pdf="yes".
If Acrobat is NOT installed i want the ASP variable inst_pdf="no".

Then i want to use the value of this variable in my ASP page:

<form name="form" method="post" action="reg_confirm.asp" onSubmit="return checkme();">
<div align="center">
<b>Picco User Agreement</b>
</div>
<%
'inst_pdf="no"
response.write "Installed PDF = " & inst_pdf & "<br>"
%>
<table align="center">
<tr>
<% if inst_pdf = "yes" then %>
<td align="center">
Click the Print button to Print the Picco Terms & Conditions
</td>
<% else %>
<td align="center">&nbsp;</td>
<% end if %>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<% if inst_pdf = "yes" then %>
<td align="center"><iframe src="../PICCOCLICKWRAP15.pdf" width="600" height="600" scrolling="yes" name="content" class="body"></iframe></td>
<% end if %>
<% if inst_pdf = "no" then %>
<td align="center"><iframe src="get_acrobat.asp" width="600" height="500" scrolling="yes" name="content" class="body"></iframe></td>
<% end if %>
</tr>
<br>
<% if inst_pdf = "yes" then %>
<tr><td align="center">
<input type="checkbox" name="agree" id="agree" value="agree_terms">
Agree to Terms & Conditions<br>
</td></tr>
<tr><td align="center">
<input type="submit" name="accept" id="accept" value="Accept" onMouseOver="style.cursor='hand'">&nbsp;&nbsp;&nbs p;
<input type="button" name="reject" id="reject" value="Reject" onMouseOver="style.cursor='hand'" onClick="return areyousure();">&nbsp;&nbsp;&nbsp;
</td>
</tr>
<% else %>
<tr>
<td align="center">
<input type="button" name="back" id="back" value="Back" onMouseOver="style.cursor='hand'" onClick="history.back()">
</td>
</tr>
<% end if %>
</table>
<input type="hidden" name="forename" id="forename" value="<%=forename%>">
<input type="hidden" name="surname" id="surname" value="<%=surname%>">
<input type="hidden" name="comp_name" id="comp_name" value="<%=comp_name%>">
<input type="hidden" name="position" id="position" value="<%=position%>">
<input type="hidden" name="email" id="email" value="<%=email%>">

<input type="hidden" name="agencyid" id="agencyid" value="<%=agency_id%>">
<input type="hidden" name="agentid" id="agentid" value="<%=agent_id%>">
<input type="hidden" name="username" id="username" value="<%=user_name%>">
<input type="hidden" name="password" id="password" value="<%=pass_word%>">
</form>

What am i doing wrong?


www.crmpicco.co.uk
www.milklemonadechocolate.uk.tt
 
Old March 11th, 2005, 05:23 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

http://p2p.wrox.com/topic.asp?TOPIC_ID=27630,
check links provided by om_prakash


Cheers :)

vinod
 
Old March 11th, 2005, 05:34 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

If you want to check it by a component
they this link help you
http://www.4guysfromrolla.com/webtech/121400-1.2.shtml

Using BrowserHawk to Perform Browser Detection


Cheers :)

vinod
 
Old March 11th, 2005, 11:07 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

The complete working script:

<script language="JavaScript" type="text/javascript" src="acrobat.js"></script>
<script language="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 This is required to Print the Terms & Conditions\nClick OK to download this software now. Click Cancel to go Back")
    if (question !="0"){
        top.location = 'get_acrobat.asp'
    }
    if (question =="0"){
        history.back()
    }
}
</script>

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt





Similar Threads
Thread Thread Starter Forum Replies Last Post
storing Javascript variable to ASP variable rupen Classic ASP Basics 5 April 10th, 2007 07:06 AM
assign javascript variable to asp variable manjunath_c_k Classic ASP Basics 1 September 14th, 2006 07:35 AM
set a asp variable with a value in Javascript crmpicco Classic ASP Basics 3 March 10th, 2005 10:46 AM
set ASP variable values inside Javascript crmpicco HTML Code Clinic 1 March 9th, 2005 12:32 PM
asp javascript "record set help" terry_s Classic ASP Basics 2 April 19th, 2004 07:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.