navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Refer to asp variable in javascript

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Refer to asp variable in javascript
Page: [1]
 
malky800

 

Posts: 116
Joined: 1/11/2006
Status: offline

 
Refer to asp variable in javascript - 9/28/2008 23:19:57   

I'm writing script alternating in asp and js, (mostly because I need an alert box).
I start on top with asp variables based on a response from a stored procedure.

dim RYear
RYear = CarInfo.Fields.Item("TheYear").Value 


Is there a way to refer back to that variable once I switch to javascript.
<SCRIPT LANGUAGE="JavaScript">
alert("The year you have entered is invalid. It should be " & ___________)
</script>


I want the blank to fill in with that variable RYear.
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Refer to asp variable in javascript - 9/29/2008 8:24:31   
quote:

Is there a way to refer back to that variable once I switch to javascript.


Yes but it has to be during the page building and loading. ANd I have to qualify "switching to JS". You can't refer to it once the page has been sent to the client since ASP is a server-side script. But you can populate your JavaScripts with ASP variable values.

It could look somehting like this:

<SCRIPT LANGUAGE="JavaScript">
alert("The year you have entered is invalid. It should be <%=myASPDateVariable%>");
</script>

Just remeber on page load they are no longer variables but turn into hardcode JavaScript.

That help any?


_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to malky800)
malky800

 

Posts: 116
Joined: 1/11/2006
Status: offline

 
RE: Refer to asp variable in javascript - 9/29/2008 14:33:04   
Thank you it worked.

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Refer to asp variable in javascript
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts