|
| |
|
|
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.
|
|
|
|
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.
|
|
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
|
|
|