document.writeln("<script type=\"text\/javascript\"><!--");
document.writeln('google_ad_client = "pub-5203053864771666";');
document.writeln('google_ad_format = "js_sdo";');
document.writeln('google_cts_mode = "rs";');
document.writeln('google_num_cts = "2";');
document.writeln('google_searchbox_width = 215;');
document.writeln('google_searchbox_height = 26;');
document.writeln('google_link_target = 2;');
document.writeln('google_logo_pos = "left";');
document.writeln('google_rs_pos = "right";');
document.writeln('google_ad_height = 35;');
document.writeln('google_ad_width = 560;');
document.writeln('</script>');
document.writeln('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_sdo.js%22%3E');
document.writeln('</script>');
调用代码如下:
<div><script language="JavaScript" src=http://www.hongy168.com/ type="text/javascript"></script></div>
other way:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<title>a</title>
</head>
<body>
<div style="border:1px dotted;400px">
<iframe id="frame_content" src="iframe_b.html" scrolling="no" frameborder="0" onload="this.height=100"></iframe>
</div>
<div><button onclick="checkHeight()">Check Height</button></div>
<script type="text/javascript">
function reinitIframe(){
var iframe = document.getElementById("frame_content");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
function checkHeight() {
var iframe = document.getElementById("frame_content");
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
alert("bHeight:" + bHeight + ", dHeight:" + dHeight);
}
</script>
</body>
</html>