set css to a button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anudu
    New Member
    • Oct 2007
    • 31

    set css to a button

    hi,

    I am developing a system with asp.net and javascript.

    I am creating a html table dynamically using a for loop in a javascript function. i have a button field in my table.

    this is the code I use.


    [CODE=javascript] btn=document.cr eateElement('in put');
    btn.type='butto n';

    btn.id=dset.val ue.Tables[0].Rows[a].BasicNo;
    btn.style.width ="9";
    btn.style.heigh t="9";[/CODE]

    I want to apply a style sheet for this button. can I create the stylesheet inside the javascript.? if I have the stylesheet designed in a separate file (styles.css) in a separate folder , how can I apply it.


    Thanks

    Anushka
    Last edited by gits; Mar 26 '08, 09:43 AM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    in case you have a class in a linked external stylesheet then use:

    [CODE=javascript]btn.className = 'your_css_class _name';[/CODE]
    kind regards

    Comment

    Working...