01.
02.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
03.
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
lang
=
"zh-CN"
>
04.
<
head
>
05.
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=gb2312"
/>
06.
<
title
></
title
>
07.
</
head
>
08.
<
body
>
09.
<
iframe
id
=
"FF"
src
=
"B.htm"
></
iframe
>
10.
<
input
type
=
"submit"
value
=
" OK "
onclick
=
"OK()"
/>
11.
12.
<
script
language
=
"JavaScript"
>
13.
function OK()
14.
{
15.
// 操作iframe中内容的CSS
16.
var iframe = document.getElementById('FF');
17.
var body = iframe.contentWindow.document.body;
18.
19.
body.style.marginTop = 50;
20.
body.style.padding = 0;
21.
body.style.fontSize = 30;
22.
body.style.textAlign = 'center';
23.
body.style.backgroundColor = 'red';
24.
body.style.color = 'blue';
25.
}
26.
</
script
>
27.
</
body
>
28.
</
html
>