Filefox下,ASP.net如何实现页面自动适应屏幕大小?

lyyshui 2008-05-14 11:11:02
在Filefox下,ASP.net如何实现页面自动适应屏幕大小?
不论分辨率和屏幕大小
...全文
551 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
看看看灰机 2012-05-30
  • 打赏
  • 举报
回复
学习。。
didamsma 2008-05-22
  • 打赏
  • 举报
回复
mark...学习
lyyshui 2008-05-22
  • 打赏
  • 举报
回复
8楼的代码不能控制。
应用了xuyiazl获取高度的代码(很好用):
var getPageHeight = function() {
var windowHeight
if (self.innerHeight) { // all except Explorer
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowHeight = document.body.clientHeight;
}
return windowHeight
}

现在问题已经解决,非常感谢大家!!!
一会结贴----
gaoyipu 2008-05-21
  • 打赏
  • 举报
回复
学习
wfyfngu 2008-05-21
  • 打赏
  • 举报
回复
<div id="fullDIV"></div>

<script type="text/javascript">

var divEl = document.getElementById('fullDIV');

window.onresize = window.onload = function() {
if(divEl) {
divEl.style.width = document.body.clientWidth + "px";
divEl.style.height = document.body.clientHeight + "px";
}
};



</script>
lyyshui 2008-05-21
  • 打赏
  • 举报
回复
非常感谢xuyiazl,以前好像见到过获取浏览器的宽度高度代码,试一下!
xuyiazl 2008-05-20
  • 打赏
  • 举报
回复

//获取不同浏览器的宽度高度核心代码一

var getPageScroll = function() {
var xScroll, yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
xScroll = document.body.scrollLeft;
}
return new Array(xScroll,yScroll)
}

// adapter from getPageSize() by quirksmode.com
var getPageHeight = function() {
var windowHeight
if (self.innerHeight) { // all except Explorer
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowHeight = document.body.clientHeight;
}
return windowHeight
}
//获取不同浏览器的宽度高度核心代码二
var getPageScroll = function (){
var yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
}
arrayPageScroll = new Array('',yScroll)
return arrayPageScroll;
}
var getPageSize = function(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
lyyshui 2008-05-19
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 46539492 的回复:]
<style>
html,body <!-主要是兼容firefox-->
{
hright:100%;
}
</style>
===========
试试?
[/Quote]

现在用的是Firefox/2.0.0.14
以前的版本这样设置的话可以,但现在的版本这样设置还是不好用。

请指点!!!
46539492 2008-05-17
  • 打赏
  • 举报
回复
<style>
html,body <!-主要是兼容firefox-->
{
hright:100%;
}
</style>
===========
试试?
lyyshui 2008-05-17
  • 打赏
  • 举报
回复
请教高手指点!!!
lyyshui 2008-05-14
  • 打赏
  • 举报
回复
在IE浏览器是好用的,就是在Filefox下不好使
cftea 2008-05-14
  • 打赏
  • 举报
回复
还是设置 width 和 height 为 100%,ASP.NET 中,一般在 Theme 中设置。

62,047

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧