View Full Version : new variable

02-02-2005, 05:24 PM
How do i add a value of '5' to an ASP value i have to create a new variable in javascript?

I have a variable called bookings, but i want a new javascript variable called top to be the value of bookings + 5.

Something like this below?


and do i write it out as '+top+'



02-02-2005, 10:12 PM
First of all, i am not sure i am understanding the problem quite right, but what I understood from your post is that you want a line of javascript that will be changing dinamically every time the server returns the document.

If that is the case, then your line of code should be:
top = <%=bookings%>+1
// this line should be part of an external .js file or as inline javascript
// and will be evaluated on the client, but this line will get built on the server

That way, assuming that bookings may be different every time the server puts together the returning html document, you will get lines such as:
top = 5 + 1
top = 6 + 1
... and so on...

Hope this helps,