473,388 Members | 1,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Var Assignment.

n2K
I have a var in a javascript like so:
<script language="javascript">

var timerID = null;
var timerRunning = false;
var timeIncrement = 0;
LATER in the code I need to assign a session var to the local var like
so....

timeIncrement = session("incTime")

How do I do this?

I keep getting errors like "an exception of type MS jscript runtime...
Object expected was not handled"

tx,

NB
Jul 22 '05 #1
13 1331
n2K wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:
timeIncrement = session("incTime")

How do I do this?


You cannot mix serverside and clientside code that way.

timeIncrement = '<% = session("incTime") %>'

mind the [single] quotes

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #2
n2K
Been there tried that. What happens is the STRING '<% = session("incTime")
%>' is assigned to timeIncrement!

???

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
n2K wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:
timeIncrement = session("incTime")

How do I do this?


You cannot mix serverside and clientside code that way.

timeIncrement = '<% = session("incTime") %>'

mind the [single] quotes

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #3
n2K wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
n2K wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:
timeIncrement = session("incTime")

How do I do this?

You cannot mix serverside and clientside code that way.

timeIncrement = '<% = session("incTime") %>'

mind the [single] quotes

Been there tried that. What happens is the STRING '<% =
session("incTime") %>' is assigned to timeIncrement!

???


[please do not toppost on usenet]

Not true, if used in an .asp file on an asp server.

If you don't use ASP, why post here?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #4
So leave out the quotes,

timeIncrement = <% = session("incTime") %>

or do an explicit type conversion.

Bob Barrows

n2K wrote:
Been there tried that. What happens is the STRING '<% =
session("incTime") %>' is assigned to timeIncrement!

???

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
n2K wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:
timeIncrement = session("incTime")

How do I do this?


You cannot mix serverside and clientside code that way.

timeIncrement = '<% = session("incTime") %>'

mind the [single] quotes

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


--
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.
Jul 22 '05 #5
Bob Barrows [MVP] wrote:
So either leave out the quotes,

timeIncrement = <%= session("incTime") %>

or do an explicit type conversion.

.... in your client-side code, not inside the server-side brackets

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.
Jul 22 '05 #6
n2K
Regardless how I try this, the <% and %> do not appear in the typical
hilight Yellow color!

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:ur*************@TK2MSFTNGP12.phx.gbl...
So leave out the quotes,

timeIncrement = <% = session("incTime") %>

or do an explicit type conversion.

Bob Barrows

n2K wrote:
Been there tried that. What happens is the STRING '<% =
session("incTime") %>' is assigned to timeIncrement!

???

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
n2K wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:

timeIncrement = session("incTime")

How do I do this?
You cannot mix serverside and clientside code that way.

timeIncrement = '<% = session("incTime") %>'

mind the [single] quotes

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


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

Jul 22 '05 #7
n2K
Actually it is true, I've added watches and it is assigned theString value.
And yes, in an ASP page on an ASP server. Not trying to be difficult, simply
laying out what results I am getting.

n2k

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
n2K wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
n2K wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:

timeIncrement = session("incTime")

How do I do this?
You cannot mix serverside and clientside code that way.

timeIncrement = '<% = session("incTime") %>'

mind the [single] quotes

Been there tried that. What happens is the STRING '<% =
session("incTime") %>' is assigned to timeIncrement!

???


[please do not toppost on usenet]

Not true, if used in an .asp file on an asp server.

If you don't use ASP, why post here?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #8
n2K
Perhaps if I include the entire code snippet, it may help.

SNIPPET BEGINS

<script language="javascript">

function startclock() {
stopclock();
timeValue = '<%=session("timerInc")%>';
timerID = setInterval("increment()", timeValue);
timerRunning = true;
document.images.bar.src=image00.src;
}
</script>

SNIPPET END

Thanks
n2k

"n2K" <rg*****@mentorits.com> wrote in message
news:e9*************@TK2MSFTNGP09.phx.gbl...
I have a var in a javascript like so:
<script language="javascript">

var timerID = null;
var timerRunning = false;
var timeIncrement = 0;
LATER in the code I need to assign a session var to the local var like
so....

timeIncrement = session("incTime")

How do I do this?

I keep getting errors like "an exception of type MS jscript runtime...
Object expected was not handled"

tx,

NB

Jul 22 '05 #9
n2K wrote:
Regardless how I try this, the <% and %> do not appear in the typical
hilight Yellow color!

Not for me either in a script block (assuming you are using Interdev). The
yellow-highlight is only applied in the html area. Ignore the lack of
highlighting. It works even though Interdev does not recognize it.

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.
Jul 22 '05 #10
n2K
Of course you are right. Don't know what I was thinking.

n2k
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
n2K wrote:
Regardless how I try this, the <% and %> do not appear in the typical
hilight Yellow color!

Not for me either in a script block (assuming you are using Interdev). The
yellow-highlight is only applied in the html area. Ignore the lack of
highlighting. It works even though Interdev does not recognize it.

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.

Jul 22 '05 #11
n2K wrote:
Perhaps if I include the entire code snippet, it may help.

SNIPPET BEGINS

<script language="javascript">

function startclock() {
stopclock();
timeValue = '<%=session("timerInc")%>';
As I said before, if you want timeValue to be a number, either get rid of
the quotes

timeValue = <%=session("timerInc")%>;

Or use a conversion function on the variable to convert it to a number. The
unary + operator can be used for this: timeValue = '<%=session("timerInc")%>';
timerID = setInterval("increment()", +timeValue);
timerRunning = true;
document.images.bar.src=image00.src;
}
</script>


Look at the page's source after running it (comment out the setInterval
statement) to see what is happening

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.
Jul 22 '05 #12
n2K
Bob, I tried to remove the quotes as you had previouslsy mentioned and I
still get the same error.

n2k
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:O7**************@TK2MSFTNGP15.phx.gbl...
n2K wrote:
Perhaps if I include the entire code snippet, it may help.

SNIPPET BEGINS

<script language="javascript">

function startclock() {
stopclock();
timeValue = '<%=session("timerInc")%>';


As I said before, if you want timeValue to be a number, either get rid of
the quotes

timeValue = <%=session("timerInc")%>;

Or use a conversion function on the variable to convert it to a number.
The
unary + operator can be used for this:
timeValue = '<%=session("timerInc")%>';
timerID = setInterval("increment()", +timeValue);
timerRunning = true;
document.images.bar.src=image00.src;
}
</script>


Look at the page's source after running it (comment out the setInterval
statement) to see what is happening

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.

Jul 22 '05 #13
I don't rememeber the mentioning of an error... oh! the "object expected"
error? Can you post the page's source?

Are you sure the problem isn't the increment() function? Does it work if you
hard-code a numeric value into timeValue rather than using the
response.write?

Let me try to duplicate this ... nope - it works fine for me. I think the
issue is elsewhere.

Bob Barrows

n2K wrote:
Bob, I tried to remove the quotes as you had previouslsy mentioned
and I still get the same error.

n2k
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:O7**************@TK2MSFTNGP15.phx.gbl...
n2K wrote:
Perhaps if I include the entire code snippet, it may help.

SNIPPET BEGINS

<script language="javascript">

function startclock() {
stopclock();
timeValue = '<%=session("timerInc")%>';


As I said before, if you want timeValue to be a number, either get
rid of the quotes

timeValue = <%=session("timerInc")%>;

Or use a conversion function on the variable to convert it to a
number. The
unary + operator can be used for this:
timeValue = '<%=session("timerInc")%>';
timerID = setInterval("increment()", +timeValue);
timerRunning = true;
document.images.bar.src=image00.src;
}
</script>


Look at the page's source after running it (comment out the
setInterval statement) to see what is happening

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.


--
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.
Jul 22 '05 #14

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

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
10
by: Andrew Koenig | last post by:
It has been pointed out to me that various C++ books disagree about the relative precedence of ?: and the assignment operators. In order to satisfy myself about the matter once and for all, I...
5
by: CoolPint | last post by:
It seems to me that I cannot assign objects of a class which has a constant data member since the data member cannot be changed once the constructor calls are completed. Is this the way it is meant...
16
by: Edward Diener | last post by:
Is there a way to override the default processing of the assignment operator for one's own __value types ? I realize I can program my own Assign method, and provide that for end-users of my class,...
9
by: Rick N. Backer | last post by:
I have an abstract base class that has char* members. Is an assignment operator necessary for this abstract base class? Why or why not? Thanks in advance. Ken Wilson Amer. Dlx. Tele,...
1
by: Jon Slaughter | last post by:
I have a chain of classes(i.e., a series of classes each containing an array of the next class). Each class has array like access. struct Myclass1 { vector(Myclass2) _Myclass2; Myclass2&...
166
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
6
by: Neil Zanella | last post by:
Hello, I would like to know whether the following C fragment is legal in standard C and behaves as intended under conforming implementations... union foo { char c; double d; };
35
by: nagy | last post by:
I do the following. First create lists x,y,z. Then add an element to x using the augumented assignment operator. This causes all the other lists to be changed also. But if I use the assignment...
20
by: TimeHorse | last post by:
I would like to gauge interest in the following proposal: Problem: Assignment statements cannot be used as expressions. Performing a list of mutually exclusive checks that require data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...

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.