469,276 Members | 1,630 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

set css to a button


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.

Expand|Select|Wrap|Line Numbers
  1.          btn=document.createElement('input');
  2.          btn.type='button';
  4.          btn.id=dset.value.Tables[0].Rows[a].BasicNo;
  5.          btn.style.width="9";
  6.          btn.style.height="9";
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.


Mar 26 '08 #1
1 986
5,390 Expert Mod 4TB
in case you have a class in a linked external stylesheet then use:

Expand|Select|Wrap|Line Numbers
  1. btn.className = 'your_css_class_name';
kind regards
Mar 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Skip Hollowell | last post: by
5 posts views Thread by TrvlOrm | last post: by
25 posts views Thread by KK | last post: by
3 posts views Thread by Zürcher See | last post: by
18 posts views Thread by Colin McGuire | last post: by
7 posts views Thread by =?Utf-8?B?bWFydGluMQ==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.