How can I display my screen resolution and size with JS special effects? See the following code:
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> JS testing display resolution </title>
</Head>
<Body>
<Div style = "width: 1 cm;" id = "hutia"> </div>
<Script language = "JavaScript">
Document. write ('the resolution of your display is \ n' + screen. width + '*' + screen. height + 'pixels <br/> ');
Var ww = document. getElementById ("hutia "). offsetWidth, w = screen. width/ww, h = screen. height/ww, r = Math. round (Math. sqrt (w x w + h * h)/2.54 );
Document. write ('your display size is \ n' + (screen. width/ww ). toFixed (1) + '*' + (screen. height/ww ). toFixed (1) + 'cm, '+ r +' inch <br/> ');
</SCRIPT>
</Body>
</Html>