 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
philippeoget
Joined: 14 Mar 2005 Posts: 7 Location: London, UK
|
Posted: Tue Mar 15, 2005 11:32 pm Problem accessing DIVs by reference |
|
|
|
Given the DIVs below, my problem is to access and refer to the different DIVs.
At the moment the sub below accesses the idOutput DIv, but when I tried to change the sub to "Sub WriteThis(StringToWrite, DivToWriteTo)", then I get all sort of errors.
How to I retrieve the actual DIV element, so I could have:
DivToWriteTo.insertAdjacentHtml "beforeend", StringToWrite
Sub WriteThis(StringToWrite)
idOutput.insertAdjacentHtml "beforeend", StringToWrite
End Sub
<DIV id='idOutput'>
<DIV id='idDivConfig' name="DivConfig"><b>IP Config Results:</b><br> </DIV>
<DIV id='idDivPing' name="DivPing"><b>Ping Results:</b><br> </DIV>
<DIV id='idDivTracert' name="DivTracert"><b>Tracert Results:</b><br> </DIV>
</DIV> |
|
nickyt
Joined: 16 Mar 2005 Posts: 3
|
Posted: Fri Mar 18, 2005 5:57 am |
|
|
|
First of all since you're on the client you shouldn't be using VBScript, use JavaScript so your function should look like this:
| Code: |
function WriteThis(sTargetDiv, sHTML)
{
document.getElementById("idOutput").innerHTML += sHTML
} |
I beliebe most newer versions of Mozilla based browsers including FireFox support innerHTML.
If you need to get this to work for Netscape 4, there are other ways to accomplish this. |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|