This is the JS
to detect the screen resolution on my page naming index.html
and sending it to php, so that the values can be retrived using $
I'm not sure if I understood your problem but this is what I've got: if you only intend to get the screen width and then set the class I disencourage you to do it that way. It's not nice and in the future if you need to change your page layout you'll be doomed by having all those echo in php and you'll avoid a lot of redirects (index.html -> process.php -> index.php).
By your example you can do it all in Javascript.
This is example is with JQuery
var width = $(window).width(); //get the width of the screen
$('#Wrapper').css("width",width); //set the width to the class
If the idea is for very different screen resolutions (from PCs to SmartPhones), you should consider changing your approach.
Good luck :)
TRY THIS: (I believe is what you want)
You can do this with just JS and CSS. Here is an example:
set the style for your body margin and your test div:
then add this script:
and test it with this html:
test
test
test
test
test
test
test
test
test
It works in different resolutions.
Give it a try :)