javascript pass variable to style
问题 screen_w = window.innerWidth; screen_h = window.innerHeight; to get the window deminsions and then set it to a variable. Is there a way to take that variable and then use it in my style? Such as: img { width:screen_w; height:screen_h; } I have tried <script type="text/javascript"> <style> img.. </style> </script> but that doesn't seem to work.. is this even possible or is there some other way to pass a variable? Thanks in advance. ///Added Ok so the Link down there ---v Is discussing making a