|
-
Jan 4th, 2007, 11:08 PM
#1
Thread Starter
Hyperactive Member
JavaScript : Set Text Font to Bold at Runtime
Hi I have one textbox named txtName and I want to make it's style to bold and regular at runtime in onFoucs event.
I used this but no result...
document.Form1.txtName.style.font.bold=true;
I am using .NET 2010 with Windows 7
-
Jan 5th, 2007, 12:05 AM
#2
Re: JavaScript : Set Text Font to Bold at Runtime
Code:
var txtName = document.getElementById('txtName');
if(txtName) { txtName.style.fontWeight = 'bold'; }
The element must have id="txtName" attribute for this to work.
For more details on CSS see W3C CSS property index; JavaScript uses the same names, except that properties with - character don't have it, instead the next character will be upper case. (ie. font-weight -> fontWeight).
-
Jan 5th, 2007, 03:30 AM
#3
Thread Starter
Hyperactive Member
Re: JavaScript : Set Text Font to Bold at Runtime
Thanks u very much Merri..
I am using .NET 2010 with Windows 7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|