View Single Post

  #2 (permalink)  
Old 12-16-2003
 
Posts: n/a
Default Re: Changing the values in a css


"Ike" <rxv@hotmail.com> wrote in message
news:mXIDb.1435$Ts5.235@newsread2.news.atl.earthli nk.net...
> Suppose I am creating a web page from within php. The web page will

utilize
> a style sheet. However, before I spawn this new page, I want to be able to
> change the values in the css, from, within say a javascript function in

the
> page that will call the php-created page.
>
> How might I do this? Suppose I have the following css:
> .td1 {
> font: bold 10pt Helvetica;
> background: white;
> }
> .td2 {
> font: bold 10pt Helvetica;
> background: grey;
> }
> .trhead {
> font: bold 11pt Helvetica;
> background: white;
> }And I wish to change, say, the font and background values for
> the three divisions. Is anyone aware of a class for changing a css on the
> fly? Thanks, Ike
>
>



It would be easy enough to do with the style sheet in the php page. $size
could come from a _GET or SESSION or anything.
I supposed you could also modify this to include external style sheets as
well.

# somephpfile.php

<?
$size = 12;
?>

<head>
<style>
..td1 {
font-size: <?=$size?> pt;
}
</style>
</head>
<body>
........

##

you could also call a javascript function with <body
onLoad="javascript:someFunction()">
that changes the values.





Reply With Quote