hi, i am still figuring out joins and whatnot, could someone help me
achieve this goal?
<script>
var setnumber = 5;
var total5 = 100;
alert(total+setnumber);
</script>
Ok, the alert does not work, but my goal is to do what I hope is
obvious, and that is to join the setnumber value with the word
'total', so it becomes 'total5', and so it can be accessed/utilized as
such.
Can someone please help me with this? It would be greatly
appreciated. Have a very nice day.
Rebecca. 8 1282
Hi,
On Jul 22, 5:08 pm, rebecca...@gmail.com wrote:
hi, i am still figuring out joins and whatnot, could someone help me
achieve this goal?
<script>
var setnumber = 5;
var total5 = 100;
Is the above line relevant?
alert(total+setnumber);
alert("total"+setnumber);
</script>
Ok, the alert does not work, but my goal is to do what I hope is
obvious, and that is to join the setnumber value with the word
'total', so it becomes 'total5', and so it can be accessed/utilized as
such.
Can someone please help me with this? It would be greatly
appreciated. Have a very nice day.
You might find this helpful.
<URL: http://www.jibbering.com/faq/#FAQ3_1>
Peter
On Jul 22, 8:08 pm, rebecca...@gmail.com wrote:
hi, i am still figuring out joins and whatnot, could someone help me
achieve this goal?
<script>
You are missing the type attribute (text/javascript.)
var setnumber = 5;
var total5 = 100;
alert(total+setnumber);
</script>
Ok, the alert does not work, but my goal is to do what I hope is
I don't see "total" defined.
obvious, and that is to join the setnumber value with the word
'total', so it becomes 'total5', and so it can be
Like this?
alert('total' + setnumber);
accessed/utilized as
such.
You lost me there. And why do you have a variable called "total5" set
to 100?
En réponse ŕ re********@gmail.com qui nous a susurré, en date du :
23/07/07 2:08, le message sibyllin suivant :
>
<script>
var setnumber = 5;
var total5 = 100;
alert(total+setnumber);
</script>
Ok, the alert does not work, but my goal is to do what I hope is
obvious, and that is to join the setnumber value with the word
'total', so it becomes 'total5', and so it can be accessed/utilized as
such.
alert('total = ' + window['total'+setnumber]);
there is also the function eval()
alert('total = ' + eval('total'+setnumber));
--
Stephane Moriaux et son (moins) vieux Mac re********@gmail.com said:
> hi, i am still figuring out joins and whatnot, could someone help me achieve this goal?
<script> var setnumber = 5; var total5 = 100;
alert(total+setnumber);
</script>
Ok, the alert does not work, but my goal is to do what I hope is obvious, and that is to join the setnumber value with the word 'total', so it becomes 'total5', and so it can be accessed/utilized as such.
The other two answers tell us that your goal is not obvious.
You want to reference a variable whose name is partially
supplied in the value of another variable.
alert(window["total"+setnumber]);
will alert the value of total5, if setnumber=5.
Global variables are attributes of the window object (in a browser).
If your attribute name is the value of an expression, you can use
this "square bracket notation", to access it.
This makes the object look sort of like an associative array.
-- re********@gmail.com said the following on 7/22/2007 8:08 PM:
hi, i am still figuring out joins and whatnot, could someone help me
achieve this goal?
<script>
var setnumber = 5;
var total5 = 100;
alert(total+setnumber);
</script>
Ok, the alert does not work, but my goal is to do what I hope is
obvious, and that is to join the setnumber value with the word
'total', so it becomes 'total5', and so it can be accessed/utilized as
such.
Can someone please help me with this? It would be greatly
appreciated. Have a very nice day.
alert(window['total' + setnumber])
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Peter Michaux wrote:
On Jul 22, 5:08 pm, rebecca...@gmail.com wrote:
>hi, i am still figuring out joins and whatnot, could someone help me achieve this goal?
<script> var setnumber = 5; var total5 = 100;
Is the above line relevant?
>alert(total+setnumber);
alert("total"+setnumber);
That would display "total5". However, it would see the OP wanted to
display "100":
window.alert(this["total"] + setnumber);
I recommend to use an array instead of numbered variables, though.
<URL: http://www.jibbering.com/faq/#FAQ3_1>
You must be kidding.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Peter Michaux wrote:
On Jul 22, 5:08 pm, rebecca...@gmail.com wrote:
>hi, i am still figuring out joins and whatnot, could someone help me achieve this goal?
<script> var setnumber = 5; var total5 = 100;
Is the above line relevant?
>alert(total+setnumber);
alert("total"+setnumber);
That would display "total5". However, it would see the OP wanted to
display "100":
window.alert(this["total" + setnumber]);
I recommend to use an array instead of numbered variables, though.
<URL: http://www.jibbering.com/faq/#FAQ3_1>
You must be kidding.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Thomas 'PointedEars' Lahn said the following on 8/1/2007 9:16 AM:
Peter Michaux wrote:
On Jul 22, 5:08 pm, rebecca...@gmail.com wrote:
>hi, i am still figuring out joins and whatnot, could someone help me
>achieve this goal?
>>
><script>
>var setnumber = 5;
>var total5 = 100;
>
Is the above line relevant?
>
>alert(total+setnumber);
>
alert("total"+setnumber);
That would display "total5". However, it would see the OP wanted to
display "100":
window.alert(this["total" + setnumber]);
I recommend to use an array instead of numbered variables, though.
Do you ever read a thread before replying? It has been mentioned several
times before now that an array would work better for what the OP wanted.
<URL: http://www.jibbering.com/faq/#FAQ3_1>
You must be kidding.
Why would referring the OP to buy a book (via hint) be kidding?
BTW, your posting agent, newsserver or your setup is broken for you to
be posting your reply twice.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tom |
last post by:
Please help.
I need a quick little scrpit to place on a web page that will count
how many days have passed since January 1, 1970. I have ZERO
experience writing ANY scripts. Anyone have any...
|
by: CW |
last post by:
I wrote an HTML based chat application. The front end is built entirely on
HTML + javascript. Essentially, I have a hidden frame that's refreshed
frequently and any new messages are displayed in...
|
by: Stefan Turalski \(stic\) |
last post by:
Hi,
I done sth like this:
for(int i=0; i<10; i++) {...}
and after this local declaration of i variable I try to inicialize
int i=0;
|
by: Gordon |
last post by:
Hello again,
Sorry to repost this request, but I'm under a bit of pressure to find a
quick solution.
All I basically want is an automatically updating link (OLE, not DDE)
between a control in...
|
by: Thelma Lubkin |
last post by:
I would like my DLookup criteria to say this: Trim(fieldX) = strVar:
myVar = _
DLookup("someField", "someTable", "Trim(fieldX) = '" & strVar & '")
I don't believe that this will work, and I...
| |
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need ...
|
by: shk253 |
last post by:
I've been asked to write a program that calculates the total time worked. I use struct to create variable type time1, and ask the user to enter time in and time out. I convert both to seconds and...
|
by: BryanA |
last post by:
I am new to JS and after googling for a little while I couldn't find
an answer to my question. I have an ajax JS that auto updates a
certain element. The problem is it has to request another page...
|
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,...
|
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,...
|
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...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
|
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...
| |