根据显示器分辨率调整页面显示的Javascript脚本
根据显示器分辨率调整页面显示宽度的Javascript脚本
代码示例:
1.根据分辨率,使用不同的代码.
<script type="text/javascript">
// <![CDATA[
if (screen.width>1100)
Insert_Flash('flashcontent',"images/banner1280.swf","100%",105);
//Insert_Flash是我自己写的插入flash的脚本.我为不同分辨率做了不同的flash
//如果你要插入图片,可以用 document.write('<img src="1280.png">');
else
Insert_Flash('flashcontent',"images/banner1024.swf","100%",105);
// ]]>
</script>
// <![CDATA[
if (screen.width>1100)
Insert_Flash('flashcontent',"images/banner1280.swf","100%",105);
//Insert_Flash是我自己写的插入flash的脚本.我为不同分辨率做了不同的flash
//如果你要插入图片,可以用 document.write('<img src="1280.png">');
else
Insert_Flash('flashcontent',"images/banner1024.swf","100%",105);
// ]]>
</script>
2.根据分辨率,修改css
<script type="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>
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步