根据显示器分辨率进行的调整的Javascript脚本
By greenerycn#163.com 2007年4月20日
主要代码:
1.根据分辨率,使用不同的代码.
<
scripttype
=
"
text/javascript
"
>
//
<![CDATA[
if
(screen.width
>
1100
)
Insert_Flash(
'
flashcontent
'
,
"
images/banner1280.swf
"
,
"
100%
"
,
105
);
//
Insert_Flash是我自己写的插入flash的脚本.我为不同分辨率做了不同的flash
//
如果你要插入图片,可以用document.write('<imgsrc="1280.png">');
else
Insert_Flash(
'
flashcontent
'
,
"
images/banner1024.swf
"
,
"
100%
"
,
105
);
//
]]>
</
script
>
2.根据分辨率,修改css
<
scripttype
=
"
text/javascript
"
>
if (screen.width > 1100 )
document.getElementById( " text_flash " ).style.left = " 600px " ;
</ script >
if (screen.width > 1100 )
document.getElementById( " text_flash " ).style.left = " 600px " ;
</ script >
本文介绍了一段JavaScript脚本,该脚本可根据浏览器屏幕分辨率的不同来调整网页内容的显示方式,包括插入不同版本的Flash内容及修改CSS样式。
2377

被折叠的 条评论
为什么被折叠?



