473,606 Members | 3,113 Online
Bytes | Software Development & Data Engineering Community
+ 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=<%=recuu r%>
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.Creat eObject("ADODB. Recordset")
rs.open sql, OBJDC, 3, 3
dim allhr
Set rs = objdc.execute(s ql)
if not rs.eof then
allhr = rs.GetRows()
recuur = UBound(allhr, 2) + 1 => =10
end if
....
%>
.....
<script type="text/javascript">
totday=<%=totda y%>
recuur=<%=recuu r%>
....

Dec 5 '05 #1
6 1675
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=<%=recuu r%>
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.javas cript 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=<%=recuu r%>) is considered as an syntax error and not without 'var'.
If i insert ALERT between the two lines like this:
totday=<%=totda y%>
alert("ok")
var recuur=<%=recuu r%>

i get no error. Strange isn't it?
"Randy Webb" <Hi************ @aol.com> wrote in message
news:x6******** ************@co mcast.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=<%=recuu r%>
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.javas cript 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.c a> a écrit dans le message de
news:eD******** ********@TK2MSF TNGP09.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=<%=recuu r%>) is considered as an syntax error and not without 'var'. If i insert ALERT between the two lines like this:
totday=<%=totda y%>
alert("ok")
var recuur=<%=recuu r%>

i get no error. Strange isn't it?
"Randy Webb" <Hi************ @aol.com> wrote in message
news:x6******** ************@co mcast.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=<%=recuu r%>
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.javas cript 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.javas cript 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=<%=recuu r%>) is considered as an syntax error and not without 'var'.
If i insert ALERT between the two lines like this:
totday=<%=totda y%>
alert("ok")
var recuur=<%=recuu r%>

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.javas cript 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=<%=recuu r%>) is considered as an syntax error and not without
'var'. If i insert ALERT between the two lines like this:
totday=<%=totda y%>
alert("ok")
var recuur=<%=recuu r%>

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=<%=recuu r%>) is considered as an syntax error and not without
'var'. If i insert ALERT between the two lines like this:
totday=<%=totda y%>
alert("ok")
var recuur=<%=recuu r%>

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
7619
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: RHINO.CALLED01: 18: SQL0104N An unexpected token "<cursor declaration>" was found following "". Expected tokens may include: "<SQL statement>". LINE NUMBER=18 SQLSTATE=42601 Here is the source code for the proc; line 18 is the line that begins
6
4732
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 appreciated. Thanks in advance
6
2767
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 appreciated. Thanks in advance
2
5312
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: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
9
4747
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
8448
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8126
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5470
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3948
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4010
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2454
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 we have to send another system
1
1572
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1313
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.