I forgot that it should be quotes around the name, i.e:
document.all["LAB<%=live%>"].disabled = false;
/Robert
-----Original Message-----
From: Alex Shiell, ITS, EC, SE [mailto:alex.shiell@s...]
Sent: den 30 oktober 2001 18:25
To: javascript
Subject: [javascript] RE: quite annoying
yes it would, providing that the ASP variable live contained the appropriate
value. This value would have to be determined at the server before any
client side code has run, so this value could not be modified by the client.
for example if the varaible 'live' on the server contains 4, then the
javascript that is received by the client would say
document.all[LAB4].disabled = false;
The value is now stuck in there - it is not something that can be modified
by anything in the client.
-----Original Message-----
From: Nyman, Robert [mailto:Robert.Nyman@i...]
Sent: 30 October 2001 15:39
To: javascript
Subject: [javascript] RE: quite annoying
Also, shouldn't this work in IE4 (if one wants to avoid eval):
document.all[LAB<%=live%>].disabled = false;
/Robert
-----Original Message-----
From: Alex Shiell, ITS, EC, SE [mailto:alex.shiell@s...]
Sent: den 30 oktober 2001 15:56
To: javascript
Subject: [javascript] RE: quite annoying
I think its pretty much unique to javascript. The current recommendation is
to use getElementById() rather than eval(), but that will only work in IE5+
and NS6+
document.getElementById("LAB"+installNum)
-----Original Message-----
From: Magnus Tullock [mailto:magnus.tullock@a...]
Sent: 30 October 2001 14:48
To: javascript
Subject: [javascript] RE: quite annoying
guys thanks, the eval() worked a treat in all my years of programming c++,
Java, VBScript and to a lesser extent Javascript I have never stumbled on
it before.
Robert FYI LAB3 is a checkbox and we currently target IE4 and above.
cheers again
> What browsers are you targetting?
> What kind of an element is document.installform.LAB3?
>
>
> /Robert
>
>
>
> -----Original Message-----
> From: Magnus Tullock [mailto:magnus.tullock@a...]
> Sent: den 30 oktober 2001 14:50
> To: javascript
> Subject: [javascript] RE: quite annoying
>
>
> ok heres the deal, I have a dynamic table wich the user can add new rows
> on the click of a button. Each row is the same with some fields
disabled
> when the user changes a dropdown box I want to enable all the disabled
> objects on that row. at the moment I am doing:
>
> function livedamnyoulive(){
> if(installNum == 1){
> <%live = 1%>}
> if(installNum == 2){
> <%live = 2%>}
> if(installNum == 3){
> <%live = 3%>}
> if(installNum == 4){
> <%live = 4%>}
> if(installNum == 5){
> <%live = 5%>}
> if(installNum == 6){
> <%live = 6%>}
> if(installNum == 7){
> <%live = 7%>}
> if(installNum == 8){
> <%live = 8%>}
> if(installNum == 9){
> <%live = 9%>}
> if(installNum == 10){
> <%live = 10%>}
> document.installform.LAB<%=live%>.disabled = false;
> }
> so in installNum is 3 the last line of the code would come out as :
>
> document.installform.LAB3.disabled = false;
>
> If I could do the same with Javascript it would be even better ie:
> document.installform.LAB+installNum.disabled = false;
>
> But obviously this dont work -- any suggections guys?
>
> > The problem is that the ASP code doesn't care about the JavaScript
if's.
> > The ASP code gets generated at the server, but your client-side
> JavaScript
> > variable
> > doesn't get processed until the page is posted to the client.
> >
> > Rather show us how you want to use the variable and it's value.
> >
> >
> > /Robert
> >
> >
> > -----Original Message-----
> > From: Magnus Tullock [mailto:magnus.tullock@a...]
> > Sent: den 30 oktober 2001 13:37
> > To: javascript
> > Subject: [javascript] RE: quite annoying
> >
> >
> > oh yeah sorry that was a spelling and copy and paste mistake on my
part
> I
> > am doing == in the program
> >
> > > You are forgetting that in Javascript the = is an assignment, what
you
> > > should be doing is
> > > if (var1 == 1)
> > > <%myVar = 1%>
> > >
> > > -----Original Message-----
> > > From: Magnus Tullock [mailto:magnus.tullock@a...]
> > > Sent: Tuesday, October 30, 2001 12:24 PM
> > > To: javascript
> > > Subject: [javascript] quite annoying
> > >
> > >
> > > Hi guys, I have a really annoying problem I have a JavaScript
number
> and
> > > need it converted into a VBScript number without refreshing or
sending
> to
> > > another page. I though somthing like a series of if statements ie:
> > >
> > >
> > > if (var1 = 1)
> > > <%myVar = 1%>
> > > if (var1 = 2)
> > > <%myVar = 2%>
> > > if (var1 = 3)
> > > <%myVar = 3%>
> > > if (var1 = 4)
> > > <%myVar = 4%>
> > >
> > > but what this does is ALWAYS set the VBScript number to 4, as it is
> > > compiled first. Any ideas guys as this is infuriating me!!! :)