Click to See Complete Forum and Search --> : update css after load?
JustXtreme
12-04-2008, 01:06 PM
hello all,
is there a way to change the css after the page loads? i have a javascript that generates numbers that i want to insert in to my css but i'm not sure how to do this after the page loads?
You don't insert javascript into CSS and vice versa. Javascripting can create some CSS - that's just about it.
JustXtreme
12-04-2008, 01:10 PM
so i can't do this,
position:absolute;
left:<span id='spanx'></span>;
top:<span id='spany'></span>;
and javascript generate the numbers in it then reload the css.
Nope - you're inserting HTML into CSS ---- not a good thing.
JustXtreme
12-04-2008, 01:18 PM
ok, thanx
bejitto101
12-05-2008, 01:45 AM
I never tried this, but I was always curious, could you do this with PHP? Same things goes for javascript, could you have PHP create snippets of js code?
You can have PHP create snippets of js. (not within the js, but have PHP write the whole script) But you can't insert PHP into CSS. CSS isn't a scripting language that creates elements or interacts with other scripts; it can only alter presentation of existing elements as they are displayed in the browser.