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

Home Posts Topics Members FAQ

error with variable declaration

Hi,

My problem is:
when i declare variable 'recuur' in Jscript like it is below, no problem.
But if i declare 'recuur' like: var recuur=<%=recuur%>
then i get two errors:
"totday is not defined" and "syntax error: var recuur=10"

Any idea what's wrong?
Thanks
Kevin

<%
totday=request.cookies("totday") => =14
.....
sql="select range from hr order by range;"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open sql, OBJDC, 3, 3
dim allhr
Set rs = objdc.execute(sql)
if not rs.eof then
allhr = rs.GetRows()
recuur = UBound(allhr, 2) + 1 => =10
end if
....
%>
.....
<script type="text/javascript">
totday=<%=totday%>
recuur=<%=recuur%>
....

Dec 5 '05 #1
6 1666
Kevin said the following on 12/5/2005 3:37 PM:
Hi,

My problem is:
when i declare variable 'recuur' in Jscript like it is below, no problem.
But if i declare 'recuur' like: var recuur=<%=recuur%>
then i get two errors:
"totday is not defined" and "syntax error: var recuur=10"

Any idea what's wrong?


Show the actual code that gets sent to the browser, not the ASP Code
that generates it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 5 '05 #2
I found it.
I was wrong: '<%=totday%>' had no value because the cookie had the wrong
name.
But what i still don't understand, is why the next line (var
recuur=<%=recuur%>) is considered as an syntax error and not without 'var'.
If i insert ALERT between the two lines like this:
totday=<%=totday%>
alert("ok")
var recuur=<%=recuur%>

i get no error. Strange isn't it?
"Randy Webb" <Hi************@aol.com> wrote in message
news:x6********************@comcast.com...
Kevin said the following on 12/5/2005 3:37 PM:
Hi,

My problem is:
when i declare variable 'recuur' in Jscript like it is below, no problem. But if i declare 'recuur' like: var recuur=<%=recuur%>
then i get two errors:
"totday is not defined" and "syntax error: var recuur=10"

Any idea what's wrong?


Show the actual code that gets sent to the browser, not the ASP Code
that generates it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -

http://www.JavascriptToolbox.com/bestpractices/
Dec 6 '05 #3
As Randy said, jsut check the JS code created by your ASP pages... Also it
looks like you forgot ; at the end of each line...
--

"Kevin" <ks****@smart.ca> a écrit dans le message de
news:eD****************@TK2MSFTNGP09.phx.gbl...
I found it.
I was wrong: '<%=totday%>' had no value because the cookie had the wrong
name.
But what i still don't understand, is why the next line (var
recuur=<%=recuur%>) is considered as an syntax error and not without 'var'. If i insert ALERT between the two lines like this:
totday=<%=totday%>
alert("ok")
var recuur=<%=recuur%>

i get no error. Strange isn't it?
"Randy Webb" <Hi************@aol.com> wrote in message
news:x6********************@comcast.com...
Kevin said the following on 12/5/2005 3:37 PM:
Hi,

My problem is:
when i declare variable 'recuur' in Jscript like it is below, no problem. But if i declare 'recuur' like: var recuur=<%=recuur%>
then i get two errors:
"totday is not defined" and "syntax error: var recuur=10"

Any idea what's wrong?


Show the actual code that gets sent to the browser, not the ASP Code
that generates it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -

http://www.JavascriptToolbox.com/bestpractices/

Dec 6 '05 #4
Patrice said the following on 12/6/2005 5:16 AM:
As Randy said, jsut check the JS code created by your ASP pages... Also it
looks like you forgot ; at the end of each line...


The ; at the end of the line is optional and has no bearing on syntax
errors.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 6 '05 #5
Kevin said the following on 12/6/2005 3:16 AM:
I found it.
I was wrong: '<%=totday%>' had no value because the cookie had the wrong
name.
But what i still don't understand, is why the next line (var
recuur=<%=recuur%>) is considered as an syntax error and not without 'var'.
If i insert ALERT between the two lines like this:
totday=<%=totday%>
alert("ok")
var recuur=<%=recuur%>

i get no error. Strange isn't it?


It depends on what the server is sending to the browser. You have to
check the code generated by the server (not the server side code) when
trying to debug client-side script issues.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 6 '05 #6
Kevin wrote:
I found it.
I was wrong: '<%=totday%>' had no value because the cookie had the
wrong name.
But what i still don't understand, is why the next line (var
recuur=<%=recuur%>) is considered as an syntax error and not without
'var'. If i insert ALERT between the two lines like this:
totday=<%=totday%>
alert("ok")
var recuur=<%=recuur%>

i get no error. Strange isn't it?


Randy Webb wrote: Kevin said the following on 12/6/2005 3:16 AM:
I found it.
I was wrong: '<%=totday%>' had no value because the cookie had the
wrong name.
But what i still don't understand, is why the next line (var
recuur=<%=recuur%>) is considered as an syntax error and not without
'var'. If i insert ALERT between the two lines like this:
totday=<%=totday%>
alert("ok")
var recuur=<%=recuur%>

i get no error. Strange isn't it?


It depends on what the server is sending to the browser. You have to
check the code generated by the server (not the server side code) when
trying to debug client-side script issues.

What Randy means is that you need to load the page into your browser and
click View Source so you can see the final resulting javascript code.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 6 '05 #7

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

Similar topics

18
7586
by: Rhino | last post by:
I am having a problem with a nested SQL Procedure on DB2 V8.2.1 on Windows. This simple-looking proc is giving me this error message when I try to build it in the Development Center: ...
6
4706
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
6
2759
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
2
5298
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
9
4735
by: fcvcnet | last post by:
Hi, I write a class class CSegment { public: CSegment(void); public: ~CSegment(void); public: CArray< CList< CPoint, CPoint& >, CList< CPoint, CPoint& >& m_curve;
0
7055
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
7059
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,...
1
6758
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7010
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3011
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
3003
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
203
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.