Login | |
|
 |
RE: Need Help with setAttribute - 4/21/2006 3:52:32 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
I would say just make the change when you create the element: strButtonVal = "New Caption" Set oButton = document.createElement("<INPUT TYPE='button' ID='btn1' VALUE='" & strButtonVal & "' ONCLICK='buttonClick()'>")
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Need Help with setAttribute - 4/24/2006 6:50:14 AM
|
|
 |
|
| |
ehvbs
Posts: 2220
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
|
I was wondering why (1) Set oButton = document.createElement("<INPUT TYPE='button' ID='btn1' VALUE='Old Caption' ONCLICK='buttonClick()'>") (2) oButton.setAttribute "Value", "New Caption" didn't work. Because somebody who doesn't state his questions clearly has to provide the answer himself, I tried to think (always difficult!), did some tests, and googled until I could identify the culprits: (1) value is "VALUE" in line 1 (2) value is "Value" in line 2 (3) value is value (all lowercase) in HTML/DOM (4) setAttribute( sName, vValue [, iFlags ] ) iFlags = 0: ignore case iFlags = 1 (default): honor case [see http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setattribute.asp] Therefore oButton.setAttribute "Value", "New Caption", 0 oButton.setAttribute "value", "New Caption", 1 are okay (tested).
|
|
| |
|
|
|
|
|