Click to See Complete Forum and Search --> : A Simple Question
singold
05-24-2003, 04:14 AM
<Script language = "JavaScript">
var aa = "00";
var tt00= 100;
// Now I will use aa's value to output the tt00's value
// But I can not find the correct express. The error is:
document.write(tt&aa); //Try to output tt00
//Could you tell me the correct express?
</Script>
Nevermore
05-24-2003, 04:34 AM
What exactly are you trying to output?
Charles
05-24-2003, 05:51 AM
I think that this is what they are up to:
<script type="text/javascript">
<!--
var aa = '00';
var tt00= 100;
alert(eval('tt' + aa));
// or
alert(self['tt' + aa]);
// -->
</script>
It's a not uncommon question. However, it almost always means that they are way much doing things the hard way. They should be using Arrays or Objects.
singold
05-24-2003, 09:17 AM
Really, I will get the value like follow:
....
<td width="33%" id= td01>Hello </td>
<td width="33%" id= td02>Hello2 </td>
<td width="34%" id= td03>Hello3 </td>
....
I must visit the id, I will use for() to visit td01 td02...
the self["td"+i].innText can get "hello".
Thank you. I will continue my programs.
singold
05-24-2003, 09:23 AM
Really, I will get the value like follow:
....
<td width="33%" id= td01>Hello </td>
<td width="33%" id= td02>Hello2 </td>
<td width="34%" id= td03>Hello3 </td>
....
I must visit the id, I will use for() to visit td01 td02...
the self["td"+i].innText can get "hello".
Thank you. I will continue my programs.