Note For Me
the place I write down my taste of study
BlogJava
首頁
新文章
新隨筆
聚合
管理
posts - 3, comments - 13, trackbacks - 0
2005年4月1日
如何實現(xiàn)iframe(嵌入式幀)的自適應(yīng)高度(轉(zhuǎn)載)
原文:
http://www.knowsky.com/4928.html
好幾次看到有人提問問到如何實現(xiàn) iframe 的自適應(yīng)高度,能夠隨著頁面的長度自動的適應(yīng)以免除頁面和 iframe 同時出現(xiàn)滾動條的現(xiàn)象,剛好我在工作中也碰到了類似問題,于是上網(wǎng)翻查,東抄抄西看看,弄出來這么一個函數(shù),貼到頁面里面就能用了。不敢獨享,大家要是覺得有用,歡迎使用
源代碼如下
<
script type
=
"
text/javascript
"
>
//
** iframe自動適應(yīng)頁面 **//
//
輸入你希望根據(jù)頁面高度自動調(diào)整高度的iframe的名稱的列表
//
用逗號把每個iframe的ID分隔. 例如: ["myframe1", "myframe2"],可以只有一個窗體,則不用逗號。
//
定義iframe的ID
var
iframeids
=
[
"
test
"
]
//
如果用戶的瀏覽器不支持iframe是否將iframe隱藏 yes 表示隱藏,no表示不隱藏
var
iframehide
=
"
yes
"
function
dyniframesize()
{
var
dyniframe
=
new
Array()
for
(i
=
0
; i
<
iframeids.length; i
++
)
{
if
(document.getElementById)
{
//
自動調(diào)整iframe高度
dyniframe[dyniframe.length]
=
document.getElementById(iframeids[i]);
if
(dyniframe[i]
&&
!
window.opera)
{
dyniframe[i].style.display
=
"
block
"
if
(dyniframe[i].contentDocument
&&
dyniframe[i].contentDocument.body.offsetHeight)
//
如果用戶的瀏覽器是NetScape
dyniframe[i].height
=
dyniframe[i].contentDocument.body.offsetHeight;
else
if
(dyniframe[i].Document
&&
dyniframe[i].Document.body.scrollHeight)
//
如果用戶的瀏覽器是IE
dyniframe[i].height
=
dyniframe[i].Document.body.scrollHeight;
}
}
//
根據(jù)設(shè)定的參數(shù)來處理不支持iframe的瀏覽器的顯示問題
if
((document.all
||
document.getElementById)
&&
iframehide
==
"
no
"
)
{
var
tempobj
=
document.all
?
document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display
=
"
block
"
}
}
}
if
(window.addEventListener)
window.addEventListener(
"
load
"
, dyniframesize,
false
)
else
if
(window.attachEvent)
window.attachEvent(
"
onload
"
, dyniframesize)
else
window.onload
=
dyniframesize
</
script
>
使用的時候只要貼在
<
head
></
head
>
里面就可以了
posted @
2005-05-25 16:01
蚌殼 閱讀(589) |
評論 (1)
|
編輯
收藏
JasperReport Notes
摘要: 在公司的項目中用JapserReport也做了不少報表了,現(xiàn)在也做個記錄吧,很多東西都從網(wǎng)上而來,總結(jié)一下而已。注意:本文由 bangke 所撰寫 版權(quán)歸屬于bangke 轉(zhuǎn)載請注明出處 1.下載不說了,需要JapserReport和iReport,要pdf支持中文的話需要itextasian.jar(google!)2.資源:The JasperReports Ultim...
閱讀全文
posted @
2005-04-01 17:14
蚌殼 閱讀(6837) |
評論 (11)
|
編輯
收藏
<
2005年4月
>
日
一
二
三
四
五
六
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(4)
給我留言
查看公開留言
查看私人留言
隨筆分類
(3)
Free Thinking(1)
Java In Work(1)
Tech Tips(1)
隨筆檔案
(3)
2005年5月 (1)
2005年4月 (1)
2005年3月 (1)
搜索
最新評論
1.?re: JasperReport Notes
能不能給個具體的例子放在這邊下載,謝謝
--tercel
2.?javabean數(shù)據(jù)源,子報表求教
評論內(nèi)容較長,點擊標(biāo)題查看
--樊俊
3.?re: JasperReport Notes
是啊
--kelo
4.?re: JasperReport Notes
請教各位啦,有交叉報表的例子嗎?我看了一些,可是不太明白,我是剛剛才開始研究Ireport+jasperreport,可以幫我一下嗎?
--LIUXIAO
5.?ireport問題
急!!!怎么向自定義數(shù)據(jù)源傳遞參數(shù)?謝謝
--馬上
閱讀排行榜
1.?JasperReport Notes(6837)
2.?OK,Here begin my first blog!(700)
3.?如何實現(xiàn)iframe(嵌入式幀)的自適應(yīng)高度(轉(zhuǎn)載)(589)
評論排行榜
1.?JasperReport Notes(11)
2.?OK,Here begin my first blog!(1)
3.?如何實現(xiàn)iframe(嵌入式幀)的自適應(yīng)高度(轉(zhuǎn)載)(1)
Copyright ©2025 蚌殼 Powered By
博客園
模板提供:
滬江博客
主站蜘蛛池模板:
静宁县
|
达州市
|
大同市
|
德庆县
|
崇明县
|
桦南县
|
丹江口市
|
驻马店市
|
富川
|
手机
|
滨海县
|
蒙城县
|
蕲春县
|
宁乡县
|
南岸区
|
金沙县
|
旺苍县
|
岳阳市
|
张家港市
|
台州市
|
安泽县
|
循化
|
宾川县
|
荔浦县
|
翼城县
|
玛多县
|
栾川县
|
丰台区
|
始兴县
|
曲沃县
|
宜章县
|
永年县
|
繁昌县
|
长顺县
|
吴忠市
|
怀仁县
|
芦溪县
|
信宜市
|
方城县
|
怀集县
|
中牟县
|