This javascript function will help you. Call it as
var drop2 = findControl("select", "contactWebUserControl_DropDownList2");
function findControl(tagName, controlId)
{
var aControls = document.getElementsByTagName(tagName);
if (aControls==null)
return null;
for (var i=0; i< aControls.length; i++)
{
var j = aControls[i].id.lastIndexOf(controlId);
if ((j -1) && (j == (aControls[i].id.length - controlId.length)))
return aControls[i];
}
return null;
}
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"JFB" <he**@jfb.comwrote in message
news:Op**************@TK2MSFTNGP03.phx.gbl...
Hi all,
This is crazy...
The name of my dropdownlist on the ascx page is:
nameOfMyControl_DropDownListName
Like:
contactWebUserControl_DropDownList2
Now I put my ascx in sharepoint and the name is :
<select
name="Left:g_708f9018_c320_46a1_bb9c_ebb3b67b8184: _ctl0:DropDownList2"
id="Left_g_708f9018_c320_46a1_bb9c_ebb3b67b8184__c tl0_DropDownList2"
I have a fuction in java to catch this name as:
var drop2 =
document.getElementById("contactWebUserControl_Dro pDownList2");
How can I do it now??
Tks
JFB