473,473 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

assign javascript variable value to VBScript server side variable

If I assign VBScript server side variable a to javascript variable x, it is
fine.
<%
Dim a, b
a = 10
%>
var x = <%= a %>;
alert(x);

But if I do the other way around, then it has 500 error. any ideas??

<% b %> = x;
thanks!
Jul 19 '05 #1
2 8312
Obviously, You cannot assign a client side varaible to a server side
variable.

OK, and as you think, you CANNOT assign a server side varaible to a client
side variable too.

When you say

var x = <%= a %>;

by the time the Client side script is ready to process, it sees a real value
like

var x = 5;

And this not a good practice anyway, because, you will end up in

var x = ;
if the <%= a %> happened to be NULL

--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Matt" <ma*******@hotmail.com> wrote in message
news:Ob**************@tk2msftngp13.phx.gbl...
If I assign VBScript server side variable a to javascript variable x, it is fine.
<%
Dim a, b
a = 10
%>
var x = <%= a %>;
alert(x);

But if I do the other way around, then it has 500 error. any ideas??

<% b %> = x;
thanks!

Jul 19 '05 #2
Off the top of my head!!!!!

There are a couple of options available:

1) assign the a client side variable to a form element and post the form.
2) generate a link with the variable listed among its querystrings, requires
the link to be clicked.

I would do some error checking though to make sure you are passing valid
data back and forward.

Hope this gives you a couple of ideas..
AJ

"Matt" <ma*******@hotmail.com> wrote in message
news:Ob**************@tk2msftngp13.phx.gbl...
If I assign VBScript server side variable a to javascript variable x, it is fine.
<%
Dim a, b
a = 10
%>
var x = <%= a %>;
alert(x);

But if I do the other way around, then it has 500 error. any ideas??

<% b %> = x;
thanks!

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jack | last post by:
Hello, <%@ Language=VBScript %> <% dim a a=10 'I want b=a at this place %> <Script language=VBScript> dim b </Script>
2
by: Harry Stangel | last post by:
Noble reader, My goal is to obtain the current time on the web server and display it in the client's browser. I want the server time displayed independent of the client's current clock setting,...
1
by: dspearing | last post by:
I'm new to asp, and was wondering how I could change the value of a server variable when the user clicks a button. The asp page displays a report using server side vbscript, and I have added an...
3
by: Liam Mac | last post by:
Hi All, Can anyone direct me or provide advice on how I can assign a null value to a date variable in vb.net. Basically what I'm doing is that I'm looping through a recordset where I have three...
6
by: Dan | last post by:
Excuse me if i'm being a bit thick here, but is it possible to reference a server side variable within an embedded js source file. For example, my test.js file contains alert('<%=tmpVar%>'); ...
1
by: ravindravarman | last post by:
I need to assing some value from the java script variable in the .aspx page to a server side variable in the .aspx.cs page. Can any one help me with this? Thanks, Ravi
0
by: tommyguns | last post by:
I am working with SQL server and I am trying to write a server side variable to call for the record set (the webpage code is .asp) that is being entered on the website when the button on the website...
3
nirmalsingh
by: nirmalsingh | last post by:
hai all, i want to get client control value in server side code(c#) i am using asp.net 2005. can anybody help with sample code? thanx in advance. With Lov -Nirmal
5
by: Mike P | last post by:
How would I show or hide a div that is using client side Javascript based upon a server side variable? Here are my divs : <div id="idButton5" class="otherLeftBarLink" onmouseover="javascript:...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.