Welcome to WebmasterWorld Guest from 107.20.75.63

Forum Moderators: not2easy

Message Too Old, No Replies

dynamic stylesheet

     
6:25 pm on Jan 12, 2003 (gmt 0)

New User

10+ Year Member

joined:Jan 4, 2003
posts:3
votes: 0


Hi All,

this is my first post here:


<script type="text/javascript"><!--
document.write(\'<link rel="stylesheet" type="text/css" href="http://www.blabla.net/dynamic_resolution_stylesheet.php?width=\' + screen.width + \'&height=\' + screen.height + \'&pixelDepth=\' + screen.pixelDepth + \'&colorDepth=\' + screen.colorDepth + \'&availWidth=\' + screen.availWidth + \'&availHeight=\' +screen.availHeight +\'>\');
--></script>

this way you can, if javascript is enabled, generate a dynamic stylesheet with font-size for a specific resolution.

hope you know what i mean ;-)

6:55 pm on Jan 12, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 0


Welcome to WebmasterWorld [webmasterworld.com] RevealatoR.

Be sure to read Marcia`s WebmasterWorld Welcome and Guide to the Basics [webmasterworld.com] post.

This is basically the same technique used by a lot of logging systems. Build a query string using javascript and then request some resource on some server.

Could you explain why you are escaping the single quotes. AFAIK they should not be escaped since you need them as the string delimiter. You would need to escape a single quote if you wanted to have it as a ordinary character in a string delimited by single quotes.

var test = 'Aaron\'s Party';

Andreas

7:23 pm on Jan 12, 2003 (gmt 0)

New User

10+ Year Member

joined:Jan 4, 2003
posts:3
votes: 0


Could you explain why you are escaping the single quotes

sure, it was a snipped of a php script of mine.

7:41 pm on Jan 12, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 0


Please make sure that when you post code it is working code. There are a lot of people around here who just copy and paste. They might not know why something is not working the way it is advertised.

If you are not sure, i.e. the code has not been tested, please say so explicitly.

Using here doc syntax in PHP would have saved you from having to escape quotes at all.

Andreas

9:00 pm on Jan 12, 2003 (gmt 0)

New User

10+ Year Member

joined:Jan 4, 2003
posts:3
votes: 0


i did not say it works out of the box, but ok.
9:12 pm on Jan 12, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 0


You did not and Im sorry if my comments were too harsh.

Andreas