最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

JavaScriptJquery各种代码片段

来源:动视网 责编:小采 时间:2020-11-27 20:30:53
文档

JavaScriptJquery各种代码片段

JavaScriptJquery各种代码片段:[javascript]<span style="color:rgb(102,102,102);font-size:14px;line-height:15px;background-color:rgb(192,208,246)"></span><div class="wp_syntax"><div class="code"><pre class="jav
推荐度:
导读JavaScriptJquery各种代码片段:[javascript]<span style="color:rgb(102,102,102);font-size:14px;line-height:15px;background-color:rgb(192,208,246)"></span><div class="wp_syntax"><div class="code"><pre class="jav


[javascript]
<span style="color:rgb(102,102,102);
font-size:14px;
line-height:15px;
background-color:rgb(192,208,246)"></span><div class="wp_syntax"><div class="code"><pre class="javascript" style="margin-top:15px;
margin-bottom:15px;
padding-top:0px;
padding-right:0px;
padding-bottom:0px;
padding-left:20px;
font-family:monospace;
word-wrap:break-word;
overflow-x:auto;
border-left-width:5px;
border-left-style:solid;
border-left-color:rgb(221,221,221);
font-size:12px;
line-height:21px;
color:rgb(102,102,102);
background-color:rgb(245,245,245)" name="code"><span style="color:rgb(0,51,102)"><strong>var</strong></span> adjustIframe <span style="color:rgb(51,153,51)">=</span> <span style="color:rgb(0,51,102)"><strong>function</strong></span> <span style="color:rgb(0,153,0)">(</span>id<span style="color:rgb(0,153,0)">)</span> <span style="color:rgb(0,153,0)">{</span>
<span style="color:rgb(0,51,102)"><strong>var</strong></span> iframe <span style="color:rgb(51,153,51)">=</span> document.<span style="color:rgb(102,0,102)">getElementById</span><span style="color:rgb(0,153,0)">(</span>id<span style="color:rgb(0,153,0)">)</span>
<span style="color:rgb(0,51,102)"><strong>var</strong></span> idoc <span style="color:rgb(51,153,51)">=</span> iframe.<span style="color:rgb(102,0,102)">contentWindow</span> <span style="color:rgb(51,153,51)">&&</span> iframe.<span style="color:rgb(102,0,102)">contentWindow</span>.<span style="color:rgb(102,0,102)">document</span> <span style="color:rgb(51,153,51)">||</span> iframe.<span style="color:rgb(102,0,102)">contentDocument</span><span style="color:rgb(51,153,51)">;
</span>
<span style="color:rgb(0,51,102)"><strong>var</strong></span> callback <span style="color:rgb(51,153,51)">=</span> <span style="color:rgb(0,51,102)"><strong>function</strong></span> <span style="color:rgb(0,153,0)">(</span><span style="color:rgb(0,153,0)">)</span> <span style="color:rgb(0,153,0)">{</span>
<span style="color:rgb(0,51,102)"><strong>var</strong></span> iheight <span style="color:rgb(51,153,51)">=</span> Math.<span style="color:rgb(102,0,102)">max</span><span style="color:rgb(0,153,0)">(</span>idoc.<span style="color:rgb(102,0,102)">body</span>.<span style="color:rgb(102,0,102)">scrollHeight</span><span style="color:rgb(51,153,51)">,</span> idoc.<span style="color:rgb(102,0,102)">documentElement</span>.<span style="color:rgb(102,0,102)">scrollHeight</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;
</span> <span style="color:rgb(0,102,0)"><em>
//取得其高</em></span>
iframe.<span style="color:rgb(102,0,102)">style</span>.<span style="color:rgb(102,0,102)">height</span> <span style="color:rgb(51,153,51)">=</span> iheight <span style="color:rgb(51,153,51)">+</span> <span style="color:rgb(51,102,204)">"px"</span><span style="color:rgb(51,153,51)">;
</span>
<span style="color:rgb(0,153,0)">}</span>
<span style="color:rgb(0,0,102)"><strong>if</strong></span> <span style="color:rgb(0,153,0)">(</span>iframe.<span style="color:rgb(102,0,102)">attachEvent</span><span style="color:rgb(0,153,0)">)</span> <span style="color:rgb(0,153,0)">
{</span>
iframe.<span style="color:rgb(102,0,102)">attachEvent</span><span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">"onload"</span><span style="color:rgb(51,153,51)">,</span> callback<span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;
</span>
<span style="color:rgb(0,153,0)">}</span> <span style="color:rgb(0,0,102)"><strong>else</strong></span> <span style="color:rgb(0,153,0)">{</span>
iframe.<span style="color:rgb(0,0,102)">onload</span> <span style="color:rgb(51,153,51)">=</span> callback
<span style="color:rgb(0,153,0)">}</span>
<span style="color:rgb(0,153,0)">}</span></pre><div><span style="color:rgb(0,153,0)"><br></span></div></div></div><p style="margin-top:15px;
margin-bottom:15px;
padding-top:0px;
padding-bottom:0px;
line-height:25px;
color:rgb(102,102,102)"><span id="more-664"></span></p><div class="post-top" style="background-color:initial;
padding-left:115px"></div>
[javascript]
<span style="background-color:rgb(192,208,246)"></span><span style="color:rgb(102,102,102);
font-size:14px;
line-height:15px;
background-color:rgb(192,208,246)">HTML代码如下所示:</span><p style="margin-top:15px;
margin-bottom:15px;
padding-top:0px;
padding-bottom:0px;
line-height:25px;
color:rgb(102,102,102)"></p><div class="wp_syntax"><div class="code"><pre class="html" style="margin-top:15px;
margin-bottom:15px;
padding-top:0px;
padding-right:0px;
padding-bottom:0px;
padding-left:20px;
font-family:monospace;
word-wrap:break-word;
overflow-x:auto;
border-left-width:5px;
border-left-style:solid;
border-left-color:rgb(221,221,221);
font-size:12px;
line-height:21px;
color:rgb(102,102,102)" name="code"><iframe id="js_sub_web" width="80%" frameborder="0" scrolling="no" allowTransparency="true" src="http://www.cnblogs.com/rubylouvre/archive/2009/09/15/1566722.html">
</iframe></pre></div></div><p style="margin-top:15px;
margin-bottom:15px;
padding-top:0px;
padding-bottom:0px;
line-height:25px;
color:rgb(102,102,102)">使用代码:</p><div class="wp_syntax"><div class="code"><pre class="javascript" style="margin-top:15px;
margin-bottom:15px;
padding-top:0px; padding-right:0px;
padding-bottom:0px; padding-left:20px;
font-family:monospace;
word-wrap:break-word;
overflow-x:auto;
border-left-width:5px;
border-left-style:solid;
border-left-color:rgb(221,221,221);
font-size:12px; line-height:21px;
color:rgb(102,102,102);
background-color:rgb(245,245,245)" name="code">window.<span style="color:rgb(0,0,102)">onload</span> <span style="color:rgb(51,153,51)">=</span> <span style="color:rgb(0,51,102)"><strong>function</strong></span><span style="color:rgb(0,153,0)">(</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(0,153,0)">{</span>
adjustIframe<span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">"js_sub_web"</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;</span>
<span style="color:rgb(0,153,0)">}</span></pre></div></div><div class="wp_syntax"><div class="code"><pre class="javascript" style="margin-top:15px;
margin-bottom:15px;
padding-top:0px;
padding-right:0px;
padding-bottom:0px;
padding-left:20px;
word-wrap:break-word;
overflow-x:auto; border-left-width:5px;
border-left-style:solid; border-left-color:rgb(221,221,221)" name="code"></pre></div></div><span style="color:#666666"><span style="line-height:21px"></span></span>

文档

JavaScriptJquery各种代码片段

JavaScriptJquery各种代码片段:[javascript]<span style="color:rgb(102,102,102);font-size:14px;line-height:15px;background-color:rgb(192,208,246)"></span><div class="wp_syntax"><div class="code"><pre class="jav
推荐度:
标签: 常用 js 代码
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top