|
|
 |
Re: FN-FORUM: Javascript & CSS
date posted 25th January 2005 19:16
On 25 Jan 2005 17:28:00 -0000, Charles Nullens =
[EMAIL REMOVED]
wrote:
>
>
>Hi,
>
>Is it possible to combine JS & CSS?
Yes- you can use JavaScript to change the class or other attributes of an
item, for instance, I have a web form where a table appears or disappears
depending on the value of a checkbox.
The table has the form:
There's a checkbox that includes:
name=3D"Additional" onClick=3D"showContent(this,'AddInfo');"
and the JavaScript function:
function showContent(cbox,elID) {
if (cbox.checked=3D=3Dtrue)=20
{ document.getElementByID(elID).style.display=3D'block'}
else
{ document.getElementByID(elID).style.display=3D'none'}
}
> For example if have
>
>document.write("You are logged in as ##on_username## | href=3D'index.php?page=3Dlogin&logout=3Dnow'>Logout");
>
>How do I apply CSS to the "you are logged in bit" and "logout" bits?
Rather than just putting some raw text into the rendered page, put it =
into
a named DIV, and then set the style properties of the DIV with =
JavaScript.
Or you could have a DIV there anyway, but not visible- and change the
content using JavaScript.
--=20
Marc Wilson
Cleopatra Consultants Limited - IT Consultants
2 The Grange, Cricklade Street, Old Town, Swindon SN1 3HG
Tel: (44/0) 845 890-3012 Fax: (44/0) 871 236-1531=20
Skype: cleo-marc
Mail: [EMAIL REMOVED] Web: http://www.cleopatra.co.uk
_________________________________________________________________
Try MailTraq at https://my.mailtraq.com/register.asp?code=3Dcleopatra
|
 |
|