|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Javascript in Web Parts and DOMHow do use Javascript within a Web Part to set a document.form item's value,
etc.? As in, document.forms[0].myTextBox. value = "abc"; Since the html form is not within the web part, this does not work. Hi,
dhmason wrote: > How do use Javascript within a Web Part to set a document.form item's value, Use document.getElementById.> etc.? As in, document.forms[0].myTextBox. value = "abc"; Since the html form > is not within the web part, this does not work. Note however that the ID on the client (web browser) is set automatically by ASP.NET, based on the control's ID and its container ID. To make sure that you get the correct ID, use ClientID In the code behind: "document.getElementById( '" + myTextBox.ClientID + "' ).value = 'abc';" HTH, Laurent -- Laurent Bugnion [MVP ASP.NET] Software engineering: http://www.galasoft-LB.ch PhotoAlbum: http://www.galasoft-LB.ch/pictures Support children in Calcutta: http://www.calcutta-espoir.ch |
|||||||||||||||||||||||