By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,557 Members | 1,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,557 IT Pros & Developers. It's quick & easy.

How do I use my string to change values in the HTML doc ?

P: n/a
H
Ok, heres the deal ;

I have my script code like this

var v = "place";
for (var i = 0 ; i < 5 ; i++)
{
v = v + i; // or v = "place" +i;
// Here I want to access the resource in the HTML doc, whos id="place1",
id="place2", etc etc, so how can I do that ?
// like "theValueInv".innerText = "bla bla bla bla"; if the resource
with id="place1" is for ewxample a <p>
}
I hope you clever guys can help this newbie with this ...
TIA
H
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sounds like you're needing to use JSP to make the changes. This would
happen on the "server-side" of the processing instead of your JavaScript,
which is running on the "client-side". Then you can substitute your "place"
stuff like this:

v = <%= myNewValue %> + i;

"myNewValue" is a variable you define with your JSP server-side code and it
is inserted into your JavaScript code (in this example) when the HTML
(actually .jsp) file is generated. JSP is a whole new ball game and this is
just one way to do this.......

Larry

"H" <no*********************@hotmail.com> wrote in message
news:eq********************@newsc.telia.net...
Ok, heres the deal ;

I have my script code like this

var v = "place";
for (var i = 0 ; i < 5 ; i++)
{
v = v + i; // or v = "place" +i;
// Here I want to access the resource in the HTML doc, whos id="place1", id="place2", etc etc, so how can I do that ?
// like "theValueInv".innerText = "bla bla bla bla"; if the resource
with id="place1" is for ewxample a <p>
}
I hope you clever guys can help this newbie with this ...
TIA
H

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.