<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>三水清iframe</title>
	<atom:link href="http://js8.in/tag/iframe/feed" rel="self" type="application/rss+xml" />
	<link>http://js8.in</link>
	<description>专注前端开发,分享Javascript/CSS/PHP等Web前端开发技巧</description>
	<lastBuildDate>Wed, 08 Feb 2012 11:59:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iframe自适用高度代码</title>
		<link>http://js8.in/664.html</link>
		<comments>http://js8.in/664.html#comments</comments>
		<pubDate>Sat, 15 Jan 2011 02:02:48 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[wBox]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=664</guid>
		<description><![CDATA[有不少wBox的用户反映iframe时候不可以自动撑开高度，今天在无意中看到了司徒正美的一片关于iframe自适用高度的js代码，感觉不错，转载来了。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="关于wBox iFrame回调关闭问题的解决方案" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F620.html&from=http%3A%2F%2Fjs8.in%2F664.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978870.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">关于wBox iFrame回调关闭问题的解决方案</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再谈Iframe的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F638.html&from=http%3A%2F%2Fjs8.in%2F664.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979382.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再谈Iframe的问题</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F463.html&from=http%3A%2F%2Fjs8.in%2F664.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978721.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用JavaScript在IE和Firefox下进行iframe的DOM操作</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery插件--wBox发布" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F502.html&from=http%3A%2F%2Fjs8.in%2F664.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978870.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery插件--wBox发布</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>有不少<a href="http://js8.in/wbox-jquery" title="jQuery弹出框" target="_blank">wBox</a>的用户反映iframe时候不可以自动撑开高度，今天在无意中看到了司徒正美的一片关于iframe自适用高度的js代码，感觉不错，转载来了。</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> adjustIframe <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> iframe <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>
    <span style="color: #003366; font-weight: bold;">var</span> idoc <span style="color: #339933;">=</span> iframe.<span style="color: #660066;">contentWindow</span> <span style="color: #339933;">&amp;&amp;</span> iframe.<span style="color: #660066;">contentWindow</span>.<span style="color: #660066;">document</span> <span style="color: #339933;">||</span> iframe.<span style="color: #660066;">contentDocument</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> callback <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> iheight <span style="color: #339933;">=</span> Math.<span style="color: #660066;">max</span><span style="color: #009900;">&#40;</span>idoc.<span style="color: #660066;">body</span>.<span style="color: #660066;">scrollHeight</span><span style="color: #339933;">,</span> idoc.<span style="color: #660066;">documentElement</span>.<span style="color: #660066;">scrollHeight</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//取得其高</span>
        iframe.<span style="color: #660066;">style</span>.<span style="color: #660066;">height</span> <span style="color: #339933;">=</span> iheight <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>iframe.<span style="color: #660066;">attachEvent</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        iframe.<span style="color: #660066;">attachEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;onload&quot;</span><span style="color: #339933;">,</span> callback<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        iframe.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> callback
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span id="more-664"></span><br />
HTML代码如下所示：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;iframe id=&quot;js_sub_web&quot; width=&quot;80%&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allowTransparency=&quot;true&quot; src=&quot;http://www.cnblogs.com/rubylouvre/archive/2009/09/15/1566722.html&quot;&gt;
&lt;/iframe&gt;</pre></div></div>

<p>使用代码：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     adjustIframe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;js_sub_web&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>推荐几篇关于Iframe的文章：</p>
<ol>
<li>《<a href="http://js8.in/638.html">再谈Iframe的问题</a>》</li>
<li>《<a href="http://js8.in/553.html">解决IE6 select z-index无效，遮挡div的bug</a>》</li>
<li>《<a href="http://js8.in/463.html">使用JavaScript在IE和Firefox下进行iframe的DOM操作</a>》</li>
<li>《<a href="http://js8.in/443.html">用document.domain+iframe实现Ajax跨子域</a>》</li>
<li>《<a href="http://js8.in/311.html">关于Ajax在浏览器中产生前进后退的实现方法</a>》</li>
</ol>
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/664.html" title="iframe自适用高度代码">http://js8.in/664.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/415.html" title="利用浏览器书签实现的网页划词翻译工具" rel="bookmark inlinks">利用浏览器书签实现的网页划词翻译工具</a></li>
<li><a href="http://js8.in/7.html" title="Cause I Believe" rel="bookmark inlinks">Cause I Believe</a></li>
<li><a href="http://js8.in/528.html" title="悼念地震，网站变灰CSS代码" rel="bookmark inlinks">悼念地震，网站变灰CSS代码</a></li>
<li><a href="http://js8.in/38.html" title="Ajax文章评论上线！" rel="bookmark inlinks">Ajax文章评论上线！</a></li>
<li><a href="http://js8.in/67.html" title="校内人人网忽悠用户-陈一舟牛啊~" rel="bookmark inlinks">校内人人网忽悠用户-陈一舟牛啊~</a></li>
<li><a href="http://js8.in/346.html" title="Wordpress Follow5 插件开发日记—插件后台Ajax应用及jQuery的使用" rel="bookmark inlinks">Wordpress Follow5 插件开发日记—插件后台Ajax应用及jQuery的使用</a></li>
<li><a href="http://js8.in/268.html" title="digg掘客功能上线" rel="bookmark inlinks">digg掘客功能上线</a></li>
<li><a href="http://js8.in/580.html" title="爱墙（许愿墙）程序后台添加置顶、搜索等功能" rel="bookmark inlinks">爱墙（许愿墙）程序后台添加置顶、搜索等功能</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2011. |
<a href="http://js8.in/664.html#comments">One comment</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/iframe" rel="tag">iframe</a>, <a href="http://js8.in/tag/javascript" rel="tag">javascript</a>, <a href="http://js8.in/tag/wbox" rel="tag">wBox</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="关于wBox iFrame回调关闭问题的解决方案" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F620.html&from=http%3A%2F%2Fjs8.in%2F664.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978870.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">关于wBox iFrame回调关闭问题的解决方案</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再谈Iframe的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F638.html&from=http%3A%2F%2Fjs8.in%2F664.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979382.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再谈Iframe的问题</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F463.html&from=http%3A%2F%2Fjs8.in%2F664.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978721.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用JavaScript在IE和Firefox下进行iframe的DOM操作</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery插件--wBox发布" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F502.html&from=http%3A%2F%2Fjs8.in%2F664.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978870.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery插件--wBox发布</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/664.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>再谈Iframe的问题</title>
		<link>http://js8.in/638.html</link>
		<comments>http://js8.in/638.html#comments</comments>
		<pubDate>Wed, 10 Nov 2010 03:58:18 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=638</guid>
		<description><![CDATA[iframe是可以做的事情非常多，比如通过iframe实现跨域，使用iframe解决IE6下select遮挡不住的问题，通过iframe解决Ajax的前进后退问题，再比如通过iframe实现异步上传。在很早我就写过一篇文章说明了Iframe在IE、firefox下的一些DOM操作。今天结合最近项目中遇见的iframe问题，再来谈谈iframe的一些常见问题解决方案。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F463.html&from=http%3A%2F%2Fjs8.in%2F638.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978721.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用JavaScript在IE和Firefox下进行iframe的DOM操作</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="iframe自适用高度代码" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F664.html&from=http%3A%2F%2Fjs8.in%2F638.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/24/3445909.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">iframe自适用高度代码</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="用document.domain+iframe实现Ajax跨子域" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F443.html&from=http%3A%2F%2Fjs8.in%2F638.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977722.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用document.domain+iframe实现Ajax跨子域</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6 PNG图片不透明问题的解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&from=http%3A%2F%2Fjs8.in%2F638.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/01/2770440.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6 PNG图片不透明问题的解决方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><strong>iframe</strong>是可以做的事情非常多，比如<a title="用document.domain+iframe实现Ajax跨子域" href="http://js8.in/443.html">通过iframe实现跨域</a>，使用<a title="解决IE6 select z-index无效，遮挡div的bug" href="http://js8.in/553.html" target="_blank">iframe解决IE6下select遮挡不住的问题</a>，通过<a title="关于Ajax在浏览器中产生前进后退的实现方法" href="http://js8.in/311.html" target="_blank">iframe解决Ajax的前进后退</a>问题，再比如通过iframe实现异步上传。在很早我就写过一篇文章说明了<a title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" href="http://js8.in/463.html" target="_blank">Iframe在IE、firefox下的一些DOM操作</a>。今天结合最近项目中遇见的<strong>iframe问题</strong>，再来谈谈iframe的一些常见问题解决方案。</p>
<h3>IE下iframe背景透明问题</h3>
<p>在firefox下，iframe背景默认的是透明的，在IE下默认不是透明的，我们可以使用<code>allowTransparency='true' </code>来设置IE下的iframe为透明，另外我们使用<code>scrolling ='no' </code><code>frameborder='0'</code>分别来实现iframe页面没有滚动条，边框宽度。</p>
<h3>IE6下iframe不显示的问题</h3>
<p>不得不说<strong>IE6</strong>是个操蛋的浏览器，尤其是在中国！iframe有的时候在IE6中会出现不显示的问题，主要有以下几种原因，请一一排查：</p>
<ol>
<li>可能你的iframe没有设置宽高，例如在table不居中，计算不出来td的高度，会导致这种问题</li>
<li>尝试使用下面的代码来重新载入IE6下的iframe页面：<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	document.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'fuckIE6'</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">location</span>.<span style="color: #660066;">reload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span></pre></div></div>

</blockquote>
</li>
<li>传闻iframe标签中不要把src紧跟在iframe之后，也就是<code>&lt;iframe src='js8.in' name='fuckIE6'&gt;&lt;/iframe&gt;</code>是错误的，不过我没有碰见过类似的问题，为了保险起见，还是不要写成上面的样式为妙。</li>
</ol>
<p><span id="more-638"></span></p>
<h3>iframe跨域问题</h3>
<p>如果遇见了iframe跨子域的问题，可以尝试在父窗口和子窗口添加<code>document.domain="js8.in"</code>来解决。</p>
<h3>iframe DOM操作问题</h3>
<p>iframe的DOM操作，我在《<a title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" href="http://js8.in/463.html" target="_blank">使用JavaScript在IE和Firefox下进行iframe的DOM操作</a>》中已经讲解的比较详细，并且有详细的<a title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" href="http://js8.in/mywork/iframe_dom/" target="_blank">演示</a> ，在子窗口B操作子窗口A的时候，我使用的是通过子窗口B操作父窗口来间接操作子窗口A，也就是说通过parent来选择子窗口A然后再对其进行操作。不要使用子窗口B来创建一个DOM对象然后插入到父窗口。因为这样的操作会在IE下出错！例如下面的例子：<br />
子窗口中的js代码：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> div <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
div.<span style="color: #660066;">id</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;fuckIE6&quot;</span><span style="color: #339933;">;</span>
div.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;fuckIE6&quot;</span><span style="color: #339933;">;</span>
parent.<span style="color: #660066;">document</span>.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>div<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>上面的代码会在IE出现问题，所以正确的方法是：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> div <span style="color: #339933;">=</span> parent.<span style="color: #660066;">document</span>.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
div.<span style="color: #660066;">id</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;fuckIE6&quot;</span><span style="color: #339933;">;</span>
div.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;fuckIE6&quot;</span><span style="color: #339933;">;</span>
parent.<span style="color: #660066;">document</span>.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>div<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>也就是通过父窗口创建DIV标签，然后在插入到body之后。
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/638.html" title="再谈Iframe的问题">http://js8.in/638.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/641.html" title="使用mysql筛选出某字段中文的记录" rel="bookmark inlinks">使用mysql筛选出某字段中文的记录</a></li>
<li><a href="http://js8.in/287.html" title="自己写的DeDeCMS v5.3三级菜单" rel="bookmark inlinks">自己写的DeDeCMS v5.3三级菜单</a></li>
<li><a href="http://js8.in/43.html" title="对Zblog的页面分页链接的修改" rel="bookmark inlinks">对Zblog的页面分页链接的修改</a></li>
<li><a href="http://js8.in/689.html" title="NodeList集合跟Array数组的区别" rel="bookmark inlinks">NodeList集合跟Array数组的区别</a></li>
<li><a href="http://js8.in/612.html" title="前端开发优化总结" rel="bookmark inlinks">前端开发优化总结</a></li>
<li><a href="http://js8.in/593.html" title="解决IE下setTimeout传参数的bug" rel="bookmark inlinks">解决IE下setTimeout传参数的bug</a></li>
<li><a href="http://js8.in/471.html" title="简单修改.htaccess来提高Yslow等级" rel="bookmark inlinks">简单修改.htaccess来提高Yslow等级</a></li>
<li><a href="http://js8.in/586.html" title="通过PHP批量下载图片文件" rel="bookmark inlinks">通过PHP批量下载图片文件</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2010. |
<a href="http://js8.in/638.html#comments">2 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/ie" rel="tag">IE</a>, <a href="http://js8.in/tag/iframe" rel="tag">iframe</a>, <a href="http://js8.in/tag/javascript" rel="tag">javascript</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F463.html&from=http%3A%2F%2Fjs8.in%2F638.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978721.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用JavaScript在IE和Firefox下进行iframe的DOM操作</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="iframe自适用高度代码" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F664.html&from=http%3A%2F%2Fjs8.in%2F638.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/24/3445909.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">iframe自适用高度代码</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="用document.domain+iframe实现Ajax跨子域" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F443.html&from=http%3A%2F%2Fjs8.in%2F638.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977722.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用document.domain+iframe实现Ajax跨子域</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6 PNG图片不透明问题的解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&from=http%3A%2F%2Fjs8.in%2F638.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/01/2770440.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6 PNG图片不透明问题的解决方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/638.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>使用JavaScript在IE和Firefox下进行iframe的DOM操作</title>
		<link>http://js8.in/463.html</link>
		<comments>http://js8.in/463.html#comments</comments>
		<pubDate>Tue, 26 Jan 2010 04:59:38 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=463</guid>
		<description><![CDATA[今天就写个完整的使用JavaScript进行iframe DOM操作的文章啦~跟大家讨论下IE和Firefox下iframe DOM操作的差异，然后写一个父窗口操作子窗口DOM，子窗口操作父窗口DOM，子窗口操作子窗口DOM的实例。可以兼容所有浏览器的。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="iframe自适用高度代码" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F664.html&from=http%3A%2F%2Fjs8.in%2F463.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/24/3445909.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">iframe自适用高度代码</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="javascript获取隐藏dom的宽高" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F781.html&from=http%3A%2F%2Fjs8.in%2F463.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10989685.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">javascript获取隐藏dom的宽高</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="用document.domain+iframe实现Ajax跨子域" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F443.html&from=http%3A%2F%2Fjs8.in%2F463.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977722.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用document.domain+iframe实现Ajax跨子域</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再谈Iframe的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F638.html&from=http%3A%2F%2Fjs8.in%2F463.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979382.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再谈Iframe的问题</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>昨天一个新来的同事关于<strong>iframe</strong>中进行<strong>DOM操作</strong>的问题，我说只要是不存在跨域的问题，是可以进行iframe 之间的DOM操作的。并且拿了以前写的两篇文章给新同事进行参考——《<a title="用document.domain+iframe实现Ajax跨子域" href="http://js8.in/443.html" target="_blank">用document.domain+iframe实现Ajax跨子域</a>》、《<a title="于Ajax在浏览器中产生前进后退的实现方法" href="http://js8.in/311.html">于Ajax在浏览器中产生前进后退的实现方法</a>》。其中关于使用iframe进行跨域的<a title="iframe跨域演示实例" href="http://js8.in/mywork/crossdomain/index.html" target="_blank">demo</a>，由于更换了新域名<strong>js8.in</strong>，导致了<a href="http://js8.in/mywork/crossdomain/index.html" target="_blank">demo</a>不能使用了，昨天紧急修改了一下，总算是可以使用啦~窃喜~</p>
<p>今天就写个完整的使用<strong>JavaScript</strong>进行iframe DOM操作的文章啦~跟大家讨论下IE和Firefox下<strong>iframe DOM操作</strong>的差异，然后写一个父窗口操作子窗口DOM，子窗口操作父窗口DOM，子窗口操作子窗口DOM的实例。经测试，断桥残雪写的iframe DOM操作实例，不仅仅只是在IE和Firefox下使用正常，而是可以<strong>兼容所有浏览器的</strong>。本文只是借IE和Firefox在iframe DOM操作的不同，进行分析说明JavaScript在DOM操作中两者的不同。</p>
<h3>IE和Firefox对iframe document对象的差异性</h3>
<p>在IE6、IE7中，我们可以使用 <strong>document.frames[ID].document</strong> 来访问iframe子窗口中的<strong>document对象</strong>，可是这是不符合W3C标准的写法，也是IE下独有的方法，在Firefox下却不可以使用，Firefox下使用的是符合W3C标准的 <strong>document.getElementById(ID).contentDocument </strong>方法，今天我在写实例的时候，通过IE8进行测试，IE8也是使用的符合W3C标准的 document.getElementById(ID).contentDocument 方法。所以我们可以写一个在IE和Firefox下通用的获取iframe document对象的函数—getIFrameDOM：</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> getIFrameDOM<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">contentDocument</span> <span style="color: #339933;">||</span> document.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">document</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</blockquote>
<p><em>P.S.</em>:如果我们要获取iframe的<strong>window对象</strong>，而不是document对象，可以使用document.getElementById(ID).contentWindow的方法。这样我们就可以使用子窗口中的window对象了，比如子窗口中的函数。<br />
<span id="more-463"></span></p>
<h3>在子窗口使用父窗口的函数，获取父窗口document对象</h3>
<p>在子窗口中，我们可以通过<strong>parent</strong>就可以获得父窗口的window对象，如果假如我们在父窗口有一个函数为getIFrameDOM，我们可以通过parent.getIFrameDOM来调用，同理我们使用parent.document就可以在子窗口中访问父窗口的document对象了。</p>
<h3>使用JavaScript进行iframe的DOM操作实例</h3>
<p>首先，我们在父窗口中引入两个iframe子窗口，ID分别为wIframeA、wIframeB，地址分别为：a.html、b.html。<br />
父窗口主要HTML代码如下：<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;pHello&quot; style=&quot;margin:10px auto;width:360px;height:30px;&quot;&gt;此处可通过iframeB的JavaScript函数，来替换哦~&lt;/div&gt;
&lt;iframe id=&quot;wIframeA&quot; name=&quot;myiframeA&quot; src=&quot;a.html&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;
&lt;iframe id=&quot;wIframeB&quot; name=&quot;myiframeB&quot; src=&quot;b.html&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;</pre></div></div>

</blockquote>
<p>在子窗口A、B中我放了一个ID为hello的P，以方便我们进行DOM操作演示，子窗口A、B的主要HTML代码如下：<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p id=&quot;hello&quot;&gt;Hello World!&lt;/p&gt;</pre></div></div>

</blockquote>
<p><strong>1、在iframe中，父窗口操作子窗口的DOM</strong></p>
<p>建好了父窗口跟子窗口，这样我们可以在父窗口中，通过以下iframeA()函数来把子窗口A更换P的背景颜色为红色：</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> iframeA<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #006600; font-style: italic;">//给子窗口A改变ID为hello的背景色</span>
	<span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> getIFrameDOM<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;wIframeA&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	a.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'hello'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">background</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;red&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> getIFrameDOM<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #006600; font-style: italic;">//兼容IE、Firefox的iframe DOM获取函数</span>
	<span style="color: #000066; font-weight: bold;">return</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">contentDocument</span> <span style="color: #339933;">||</span> document.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">document</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</blockquote>
<p><strong>2、在iframe中，子窗口操作父窗口的DOM</strong></p>
<p>在子窗口中，我们可以方便的进行父窗口DOM操作，只需要在DOM操作之前添加亦歌parent对象的方法就可以啦，如：在上面的子窗口B中，我们可以使用下面的代码把，父窗口中ID为“pHello”的内容给替换掉:<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">parent.<span style="color: #660066;">document</span>.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;pHello&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&lt;p style='background:#000;color:#fff;font-size:15px;'&gt;O(∩_∩)O哈哈~用子窗口B就可以替换你！不服吗？&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

</blockquote>
<p><strong>3、在iframe中，子窗口A操作子窗口B的DOM</strong></p>
<p>既然子窗口可以操作父窗口的window对象和document对象，那么子窗口也可以操作另外的子窗口的DOM啦~断桥残雪在子窗口B中可以直接使用parent直接调用父窗口中的getIFrameDOM函数获得子窗口A的document对象，这样要修改子窗口A的内容就很简单啦，如以下的代码：</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> a<span style="color: #339933;">=</span>parent.<span style="color: #660066;">getIFrameDOM</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;wIframeA&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
a.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'hello'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&lt;span style='color:blue;font-size:18px;background:yellow;'&gt;看，俺子窗口B也能DOM你A！&lt;/span&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

</blockquote>
<h3>完整的实例演示</h3>
<p>点击下面地址就可以看到断桥残雪写的完整的iframe DOM操作的演示啦：</p>
<blockquote><p><center><a href="http://js8.in/mywork/iframe_dom" target="_blank" title="使用JavaScript进行iframe的DOM操作演示">JS进行iframe的DOM操作演示点击查看</a></center></p></blockquote>
<p>到这里，你还会以为iframe的DOM操作很难吗？嘿嘿~我想有了父窗口操作子窗口DOM，子窗口操作父窗口DOM，子窗口操作子窗口DOM这三个实例讲解，我们就可以对iframe的DOM操作了如指掌啦~其实iframe在我们开发中还有很多灵活的用法，比如跨域、实现Ajax的前进后退，该兴趣的童鞋可以继续深入的阅读下面两篇文章：<a title="用document.domain+iframe实现Ajax跨子域" href="http://js8.in/443.html" target="_blank">用document.domain+iframe实现Ajax跨子域</a>》、《<a title="于Ajax在浏览器中产生前进后退的实现方法" href="http://js8.in/311.html">于Ajax在浏览器中产生前进后退的实现方法</a>》
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/463.html" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作">http://js8.in/463.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/337.html" title="jQuery浏览器判断一个bug，以及修改建议" rel="bookmark inlinks">jQuery浏览器判断一个bug，以及修改建议</a></li>
<li><a href="http://js8.in/637.html" title="【转】解析360和QQ的战争—《“听说，250干110的事儿，那就是360了”》" rel="bookmark inlinks">【转】解析360和QQ的战争—《“听说，250干110的事儿，那就是360了”》</a></li>
<li><a href="http://js8.in/711.html" title="host配置：设置电脑DNS解析文件host" rel="bookmark inlinks">host配置：设置电脑DNS解析文件host</a></li>
<li><a href="http://js8.in/602.html" title="Jquery中的offset()和position()方法详解" rel="bookmark inlinks">Jquery中的offset()和position()方法详解</a></li>
<li><a href="http://js8.in/606.html" title="解决IE6不支持max-height的bug" rel="bookmark inlinks">解决IE6不支持max-height的bug</a></li>
<li><a href="http://js8.in/283.html" title="jQuery+google weather API轻松实现天气地图（二）" rel="bookmark inlinks">jQuery+google weather API轻松实现天气地图（二）</a></li>
<li><a href="http://js8.in/736.html" title="javascript变量类型" rel="bookmark inlinks">javascript变量类型</a></li>
<li><a href="http://js8.in/530.html" title="断桥残雪爱墙出国啦！" rel="bookmark inlinks">断桥残雪爱墙出国啦！</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2010. |
<a href="http://js8.in/463.html#comments">7 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/dom" rel="tag">dom</a>, <a href="http://js8.in/tag/iframe" rel="tag">iframe</a>, <a href="http://js8.in/tag/javascript" rel="tag">javascript</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="iframe自适用高度代码" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F664.html&from=http%3A%2F%2Fjs8.in%2F463.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/24/3445909.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">iframe自适用高度代码</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="javascript获取隐藏dom的宽高" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F781.html&from=http%3A%2F%2Fjs8.in%2F463.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10989685.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">javascript获取隐藏dom的宽高</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="用document.domain+iframe实现Ajax跨子域" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F443.html&from=http%3A%2F%2Fjs8.in%2F463.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977722.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用document.domain+iframe实现Ajax跨子域</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再谈Iframe的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F638.html&from=http%3A%2F%2Fjs8.in%2F463.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979382.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再谈Iframe的问题</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/463.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>用document.domain+iframe实现Ajax跨子域</title>
		<link>http://js8.in/443.html</link>
		<comments>http://js8.in/443.html#comments</comments>
		<pubDate>Sat, 09 Jan 2010 09:03:36 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[跨域]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=443</guid>
		<description><![CDATA[Ajax跨域一直是个比较麻烦的问题，浏览器的跨域限制是为了安全，可是当我们想要在一个域名下请求另外一个域名的内容的时候就感觉不那么爽了。我在WordPress天气插件、滔滔API接口处理上都使用了JSONP的方法来实现的跨域。而今天我要通过使用JS的document.domain和iframe来解决Ajax跨子域的问题。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="[转]利用跨域资源共享（CORS）实现ajax跨域调用" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F685.html&from=http%3A%2F%2Fjs8.in%2F443.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/21/7214143.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[转]利用跨域资源共享（CORS）实现ajax跨域调用</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="关于Ajax在浏览器中产生前进后退的实现方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F311.html&from=http%3A%2F%2Fjs8.in%2F443.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/18/10980309.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">关于Ajax在浏览器中产生前进后退的实现方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F463.html&from=http%3A%2F%2Fjs8.in%2F443.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978721.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用JavaScript在IE和Firefox下进行iframe的DOM操作</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再谈Iframe的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F638.html&from=http%3A%2F%2Fjs8.in%2F443.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979382.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再谈Iframe的问题</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>Ajax跨域一直是个比较麻烦的问题，例如：断桥残雪在一个项目中使用了open打开一个跟父窗口不同域名的新页面，结果子窗口就不能传值给父窗口了；再如：我在www.2fool.cn下不可以获取love.2fool.cn域名下的页面内容。<strong>浏览器的跨域</strong>限制是为了安全，可是当我们想要在一个域名下请求另外一个域名的内容的时候就感觉不那么爽了。</p>
<p>我在<a target="_blank" title="wordpress来访者天气预报插件" href="http://js8.in/wordpress-weather" target="_blank">WordPress天气插件</a>、<a title="使用滔滔给WordPress添加博主状态" href="http://js8.in/441.html" target="_blank">滔滔API接口</a>处理上都使用了<strong>JSONP</strong>的方法来实现的跨域。而今天我要通过使用JS的<a title="用document.domain+iframe实现Ajax跨子域" href=" http://js8.in/443.html" target="_self">document.domain和iframe来解决Ajax跨子域的问题</a>。</p>
<h3>原理</h3>
<p>通过给主页面跟请求页面设置相同的document.domain来，欺骗浏览器，达到<strong>Ajax跨子域</strong>的效果，此方法在IE，chrome，Firefox，Safari，Opera下测试通过。</p>
<p><strong>缺点：</strong>无法实现不同主域名之间的通讯。并且当在一个页面中还包含有其它的iframe时，会产生安全性异常，拒绝访问。<br />
<span id="more-443"></span></p>
<h3>使用document.domain+iframe跨域实例</h3>
<p>首先我们假设主页面地址为：<a href="http://js8.in/mywork/crossdomain/index.html" target="_blank">http://js8.in/mywork/crossdomain/index.html</a>，我们要加载的内容是位于work.2fool.cn域名下的helloworld.txt。我们需要在主页面中设置<strong>document.domain</strong>为2fool.cn，然后主页面添加一个iframe，src为域名work.2fool.cn下的一个url，在iframe页面中同样设置document.domain为2fool.cn，同时<strong>iframe</strong>中需要添加Ajax的函数，例如引入jQuery.js。</p>
<p>主页index.html的主要代码如下：</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;button onclick=&quot;crossDomain();&quot;&gt;开始跨域&lt;/button&gt;
&lt;div id=&quot;ajax&quot;&gt;&lt;/div&gt;
&lt;iframe src=&quot;http://work.2fool.cn/crossdomain/iframe.html&quot; id=&quot;iframe&quot; style=&quot;display:none;&quot;&gt;
&lt;/iframe&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
document.domain = '2fool.cn';
function crossDomain(){
    var iframe=document.getElementById('iframe').contentWindow.$;        
    iframe.get(&quot;http://work.2fool.cn/crossdomain/helloworld.txt&quot;,function(data){
        document.getElementById(&quot;ajax&quot;).innerHTML=data;
    });
}
&lt;/script&gt;</pre></div></div>

</blockquote>
<p>iframe页面主要代码如下：</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
document.domain = '2fool.cn';
&lt;/script&gt;</pre></div></div>

</blockquote>
<h3>演示Demo</h3>
<p>演示地址：<a title="使用document.domain+iframe实现Ajax跨子域的演示地址" href="http://js8.in/mywork/crossdomain/index.html" target="_self">http://js8.in/mywork/crossdomain/index.html</a></p>
<p>演示下载：<a href="http://js8.in/mywork/crossdomain/crossdomain.zip">http://js8.in/mywork/crossdomain/crossdomain.zip</a>
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/443.html" title="用document.domain+iframe实现Ajax跨子域">http://js8.in/443.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/38.html" title="Ajax文章评论上线！" rel="bookmark inlinks">Ajax文章评论上线！</a></li>
<li><a href="http://js8.in/438.html" title="由一篇文章的收录说说百度和谷歌" rel="bookmark inlinks">由一篇文章的收录说说百度和谷歌</a></li>
<li><a href="http://js8.in/41.html" title="007系列我看要末路啦~" rel="bookmark inlinks">007系列我看要末路啦~</a></li>
<li><a href="http://js8.in/455.html" title="谷歌退出中国事件尘埃落定" rel="bookmark inlinks">谷歌退出中国事件尘埃落定</a></li>
<li><a href="http://js8.in/507.html" title="25大实用的jQuery技巧和解决方案" rel="bookmark inlinks">25大实用的jQuery技巧和解决方案</a></li>
<li><a href="http://js8.in/678.html" title="转变代码思路：js浏览器判断方法" rel="bookmark inlinks">转变代码思路：js浏览器判断方法</a></li>
<li><a href="http://js8.in/412.html" title="PHP生成RSS类：RSS.class.php" rel="bookmark inlinks">PHP生成RSS类：RSS.class.php</a></li>
<li><a href="http://js8.in/343.html" title="CSS 3.0 参考手册 (中文版)下载" rel="bookmark inlinks">CSS 3.0 参考手册 (中文版)下载</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2010. |
<a href="http://js8.in/443.html#comments">10 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/ajax" rel="tag">ajax</a>, <a href="http://js8.in/tag/iframe" rel="tag">iframe</a>, <a href="http://js8.in/tag/javascript" rel="tag">javascript</a>, <a href="http://js8.in/tag/%e8%b7%a8%e5%9f%9f" rel="tag">跨域</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="[转]利用跨域资源共享（CORS）实现ajax跨域调用" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F685.html&from=http%3A%2F%2Fjs8.in%2F443.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/21/7214143.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[转]利用跨域资源共享（CORS）实现ajax跨域调用</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="关于Ajax在浏览器中产生前进后退的实现方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F311.html&from=http%3A%2F%2Fjs8.in%2F443.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/18/10980309.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">关于Ajax在浏览器中产生前进后退的实现方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F463.html&from=http%3A%2F%2Fjs8.in%2F443.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978721.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用JavaScript在IE和Firefox下进行iframe的DOM操作</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再谈Iframe的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F638.html&from=http%3A%2F%2Fjs8.in%2F443.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979382.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再谈Iframe的问题</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/443.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>关于Ajax在浏览器中产生前进后退的实现方法</title>
		<link>http://js8.in/311.html</link>
		<comments>http://js8.in/311.html#comments</comments>
		<pubDate>Fri, 30 Oct 2009 20:44:01 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=311</guid>
		<description><![CDATA[关于Ajax在使用中要使浏览器产生前进后退的方法，网上比较多的方法有两种：一是采用hash值的方式，这是我们在地图preview版中使用的方法（采用jQuery的history插件）；二是使用iframe的方法，目前百度地图、Google地图采用。为使我们以后的mymap方便引用到博客等网页内容中去，并且给地图添加复制链接的方法，我们决定把地图中Ajax在浏览器产生前进后退的方法改变为iframe的方法。
实现的机制
主要使用的两个html：index.html，history.html（iframe src地址）。
主要代码参考index.html以及history.html的js部分:
现在说说实现的方式
Index.html中代码解释：
wHistory.init();
给body插入iframe跟一个表单（主要用于Safari浏览器、或者其他特殊使用，比如复制地址方面，直接取值input的value即可，不需要处理，而取iframe的src还要进行字符串的处理）
判断是否为Safari浏览器，如果是则特殊处理一下，根据不同的浏览器定义main函数
Callback函数处理返回的信息。

History.html中代码解释
对框架中的src进行处理，运行父窗口中的函数wHistory.callback(); 
测试中使用的浏览器：IE6+ ，FF， Opera10 ，Safari4，chrome欢迎大家测试其他版本的浏览器，发现问题及时提出
演示地址：http://js8.in/mywork/ajax_history_demo
下载地址：http://js8.in/uploads/soft/ajax_history_demo.rar

声明：文章未声明为原创文章，本文链接 http://js8.in/311.html. 转载请注明转自 JS8.IN ™
随机文章

Javascript中模拟PHP的base64_decode和base64_encode函数
网站首页做完了~i.2fool.cn
javascript嵌套函数的效率问题
Javascript事件触发列表与详解
windows Xp和office盗版软件避免十月20号之后出现黑屏方法
使用Apache htpasswd.exe来管理SVN帐户
windows下安装基于Apache的SVN服务器
通过javascript实现整站黑白效果


    

© 三水清 for 三水清, 2009. &#124;
6 comments &#124;在微博关注我：@清-三水清
收藏到：
人人网 &#124; 豆瓣 &#124; 开心网 &#124; QQ书签 &#124; 新浪微博 &#124; 腾讯微博

Post tags: ajax, iframe, javascript
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="用document.domain+iframe实现Ajax跨子域" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F443.html&from=http%3A%2F%2Fjs8.in%2F311.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977722.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用document.domain+iframe实现Ajax跨子域</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用hash来实现Ajax前进后退" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F464.html&from=http%3A%2F%2Fjs8.in%2F311.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/18/10979624.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用hash来实现Ajax前进后退</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F463.html&from=http%3A%2F%2Fjs8.in%2F311.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978721.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用JavaScript在IE和Firefox下进行iframe的DOM操作</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再谈Iframe的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F638.html&from=http%3A%2F%2Fjs8.in%2F311.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979382.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再谈Iframe的问题</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>关于<strong>Ajax</strong>在使用中要使<strong>浏览器</strong>产生前进后退的方法，网上比较多的方法有两种：一是采用<strong>hash值</strong>的方式，这是我们在地图preview版中使用的方法（采用jQuery的history插件）；二是使用iframe的方法，目前百度地图、Google地图采用。为使我们以后的mymap方便引用到博客等网页内容中去，并且给地图添加复制链接的方法，我们决定把地图中Ajax在浏览器产生前进后退的方法改变为<strong>iframe</strong>的方法。</p>
<h3>实现的机制</h3>
<p>主要使用的两个html：index.html，history.html（iframe src地址）。<br />
主要代码参考index.html以及history.html的js部分:</p>
<h3>现在说说实现的方式</h3>
<p>Index.html中代码解释：<br />
wHistory.init();<br />
给body插入iframe跟一个表单（主要用于Safari浏览器、或者其他特殊使用，比如复制地址方面，直接取值input的value即可，不需要处理，而取iframe的src还要进行字符串的处理）</p>
<p>判断是否为Safari浏览器，如果是则特殊处理一下，根据不同的<strong>浏览器</strong>定义main函数</p>
<p>Callback函数处理返回的信息。<br />
<span id="more-311"></span></p>
<h3>History.html中代码解释</h3>
<p>对框架中的src进行处理，运行父窗口中的函数wHistory.callback();<span style="background-color: #ffffff;"> </span></p>
<p>测试中使用的浏览器：IE6+ ，FF， Opera10 ，Safari4，chrome欢迎大家测试其他版本的浏览器，发现问题及时提出</p>
<p>演示地址：<a href="http://js8.in/mywork/ajax_history_demo" target="_blank">http://js8.in/mywork/ajax_history_demo</a></p>
<p>下载地址：<a href="http://js8.in/uploads/soft/ajax_history_demo.rar" target="_blank">http://js8.in/uploads/soft/ajax_history_demo.rar</a>
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/311.html" title="关于Ajax在浏览器中产生前进后退的实现方法">http://js8.in/311.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/672.html" title="使用navigator.geolocation来获取用户的地理位置信息" rel="bookmark inlinks">使用navigator.geolocation来获取用户的地理位置信息</a></li>
<li><a href="http://js8.in/6.html" title="经典QQ签名" rel="bookmark inlinks">经典QQ签名</a></li>
<li><a href="http://js8.in/287.html" title="自己写的DeDeCMS v5.3三级菜单" rel="bookmark inlinks">自己写的DeDeCMS v5.3三级菜单</a></li>
<li><a href="http://js8.in/49.html" title="Dedecms技巧—屏蔽禁用词语，垃圾留言过滤功能" rel="bookmark inlinks">Dedecms技巧—屏蔽禁用词语，垃圾留言过滤功能</a></li>
<li><a href="http://js8.in/374.html" title="发布WordPress来访者天气预报插件" rel="bookmark inlinks">发布WordPress来访者天气预报插件</a></li>
<li><a href="http://js8.in/688.html" title="使用windows7的virtual PC打造原装IE6、IE7、IE8测试环境" rel="bookmark inlinks">使用windows7的virtual PC打造原装IE6、IE7、IE8测试环境</a></li>
<li><a href="http://js8.in/425.html" title="淘江湖钱庄抽奖技巧" rel="bookmark inlinks">淘江湖钱庄抽奖技巧</a></li>
<li><a href="http://js8.in/445.html" title="Google AdWords免费广告费用申请下来了" rel="bookmark inlinks">Google AdWords免费广告费用申请下来了</a></li>
</ul>
<p style="margin:0;padding:0;height:1px;overflow:hidden;">
    <script type="text/javascript"><!--
        var wumiiSitePrefix = "http://js8.in";
        var wumiiEnableCustomPos = false;
        var wumiiParams = "&#038;num=4&#038;mode=3&#038;displayInFeed=1&#038;version=1.0.5.5&#038;pf=WordPress2.8.6";
    //--></script></p>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2009. |
<a href="http://js8.in/311.html#comments">6 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/ajax" rel="tag">ajax</a>, <a href="http://js8.in/tag/iframe" rel="tag">iframe</a>, <a href="http://js8.in/tag/javascript" rel="tag">javascript</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="用document.domain+iframe实现Ajax跨子域" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F443.html&from=http%3A%2F%2Fjs8.in%2F311.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977722.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用document.domain+iframe实现Ajax跨子域</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用hash来实现Ajax前进后退" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F464.html&from=http%3A%2F%2Fjs8.in%2F311.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/18/10979624.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用hash来实现Ajax前进后退</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用JavaScript在IE和Firefox下进行iframe的DOM操作" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F463.html&from=http%3A%2F%2Fjs8.in%2F311.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978721.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用JavaScript在IE和Firefox下进行iframe的DOM操作</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再谈Iframe的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F638.html&from=http%3A%2F%2Fjs8.in%2F311.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979382.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再谈Iframe的问题</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/311.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

