×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

reset html generated from subroutine

reset html generated from subroutine

reset html generated from subroutine

(OP)
Hello!
I have been struggling to find an answer to this issue.

I have an HTA application that has some buttons that create output to the page as html. I have it working, but every time a press a button the it is appended to the existing data. I am using appendchild, but I was really looking to create a new node or remove the old node at the top. My example below is my latest attempt that fails with "Could not complete the operation due to error 800a01b6." I hope someone can help!

<div id="nav">
<table>
<tr>
<td>
<INPUT TYPE="button" NAME="Customer" VALUE="Add Customer" id='AddCustomer' onclick=AddCustomer() width="175" style="width: 175px">
</td>
.
.
.
.
.
Sub AddCustomer
For Each oDiv in data
RemoveNode
Next
set oDiv = document.createElement("div")
addcust = "<TABLE COLSPAN=200 CELLPADDING=1 BORDER=0 WIDTH=500>"
addcust = addcust & "<tr>"
addcust = addcust & "<TD colspan=2 VALIGN=TOP BGCOLOR='#800000'>"
addcust = addcust & "<FONT STYLE='ARIAL NARROW' COLOR='#ffffff' SIZE=2>Customer Data</font>"
addcust = addcust & "</td>"
.
.
.
.
.
.
.
.
addcust = addcust & "</td>"
addcust = addcust & "</tr>"
addcust = addcust & "</table>"

oDiv.innerHTML = addcust
data.appendChild oDiv
End Sub

RE: reset html generated from subroutine

Try having your button call a function. In that function reset the content in the DIV to nothing, then have it add in whatever content you need.

I hope that helps.

Regards,

Mark

No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.

Check out my scripting solutions at http://www.thespidersparlor.com/vbscript

Work SMARTER not HARDER.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close