For Programmers: Free Programming Magazines  


Home > Archive > VBScript > November 2004 > change a class of an object at runtime









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author change a class of an object at runtime
Eitan

2004-11-21, 3:56 pm

Hello,
I am creating a table cell on runtime.
I want to change the style, so it will look and react like a button.
(style = "border-style: outset").

1) How can I create a button or any element on a cell ?
2) How can I change the style behaviour of a cell ?
3) Can I change the class-name of the cell on runtime ?

Thanks :)


Andrew Thompson

2004-11-21, 3:56 pm

On Sun, 21 Nov 2004 19:35:33 +0200, Eitan wrote:

> I want to change the style, so it will look and react like a button.


Why not blow the expense and use an actual button?

BTW - alt.html.dhtml, comp.lang.javascript,
microsoft.public.scripting.jscript,
microsoft.public.scripting.vbscript

...is far too wide a cross-post for this question.
Follow-Ups set to c.l.js.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
tennisbill

2004-11-21, 3:56 pm

Well, with regard to question 3), the following javascript works for
me:
document.getElementById('theButton').className = "newClassName";

Mick White

2004-11-21, 3:56 pm

Eitan wrote:

> Hello,
> I am creating a table cell on runtime.
> I want to change the style, so it will look and react like a button.
> (style = "border-style: outset").
>
> 1) How can I create a button or any element on a cell ?


element.style.borderStyle="outset" (I've never heard of this style)


> 2) How can I change the style behaviour of a cell ?


See above

> 3) Can I change the class-name of the cell on runtime ?

element.className="yourClassName"

Mick
Michael Winter

2004-11-21, 3:56 pm

On Sun, 21 Nov 2004 18:04:53 GMT, Mick White
<mwhite13BOGUS@rochester.rr.com> wrote:

[snip]

> element.style.borderStyle="outset" (I've never heard of this style)


It's a standard style, defined in both CSS 1 and 2:
<URL:http://www.w3.org/TR/REC-CSS2/box.h...tyle-properties>.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com