I am writing a script that will loop thru the elements in a page and place enclosing <STRONG> </STRONG> tags around all text inside all P elements.
I have the loop written
function start(pText)
for ( var loop = 0; loop < document.all.length; ++loop )
but am not sure how to write the next lines of code. I have
if ( document.all[ loop ].tagName = P )
{
elements += id.innerText = <STRONG>;
}
//to write changed text to screen.
pText.innerText += elements;
Also I have several paragraphs to pass to the start function, which the for loop and the next lines of code are in. Can each paragraph have the same ID tag (i.e. ID = pText)and then be passed to the start function like so:
start(pText).
If not, how do I go about passing several
paragraphs to a function?
Thanks for the help.
I have the loop written
function start(pText)
for ( var loop = 0; loop < document.all.length; ++loop )
but am not sure how to write the next lines of code. I have
if ( document.all[ loop ].tagName = P )
{
elements += id.innerText = <STRONG>;
}
//to write changed text to screen.
pText.innerText += elements;
Also I have several paragraphs to pass to the start function, which the for loop and the next lines of code are in. Can each paragraph have the same ID tag (i.e. ID = pText)and then be passed to the start function like so:
start(pText).
If not, how do I go about passing several
paragraphs to a function?
Thanks for the help.