You can try this, Access the control in javascript by using the .NET generated Id (Client Id)
In your .aspx page, <script type="text/javascript" language="javascript"> var sMyControl = "<%=txtMyControl.ClientID%>"; </script> Now you have the .NET generated Id in sMyControl Access the control in javascript by using var objMyControl = document.getElementById(sMyControl); Now set the properties which you like to change like css className,font or any other property. objMyControl.property1 = "value1"; objMyControl.property2 = "value2"; On Mon, Feb 16, 2009 at 10:48 PM, peteski <[email protected]> wrote: > > Hi all, > > I might be off the mark here, but having spent all afternoon trying to > find a way to add a class to a <li> element to specify which menu item > represents the current page in a menu.. > > I've looked at using the asp:menu control; I have found it to be akin > to using Comic Sans on a site - surely in 2009 we should be able to > simply and quickly configure the way we want out menu output, complete > with Id's classes etc.. and without .net slapping its horrible id's on > the front of my own: ct100_header_myElement. > > Using sitemap doesn't seem to give the flexibility either, I ended up > simply coding the <ul> myself, which I have no problem with, fair > enough it's not the answer to all solutions - but when you want to be > able to easily format your markup it sure seems better! > > I'm using an image replacement technique on the <a> tags inside my > <li>'s, I've tried getting hold of the <li> in code behind on page > load to attach a "current" class to the relevant item with no joy > (I've tried runat="server" on EVERYTHING)!. > > I've looked at what seems to be a crippled and more or less dead > project CSS Friendly Adaptors (now on Google groups).. and I'm close > to giving up - I remember in PHP you could simply use strstr($loc, > "what_Im_Looking_for"); granted not always the best solution, but > given the scale of my project just what I would want right now.. > > I want .net to be #1 .. my #1.. can anyone give me a lifeline here? > > Thanks > Pete >
