<?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>高度 _ 扒房网</title>
	<atom:link href="https://www.gxjlyf.com/tag/16633/feed" rel="self" type="application/rss+xml" />
	<link>https://www.gxjlyf.com</link>
	<description>手机系统教程_手机软件教程_手机app使用教程_电脑软件教程_电脑系统教程</description>
	<lastBuildDate>Sat, 26 Nov 2022 04:36:16 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>今天分享iframe</title>
		<link>https://www.gxjlyf.com/863167.html</link>
		
		<dc:creator><![CDATA[bafang18]]></dc:creator>
		<pubDate>Sat, 26 Nov 2022 04:36:16 +0000</pubDate>
				<category><![CDATA[PC教程]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[高度]]></category>
		<guid isPermaLink="false">https://www.chuwenyu.com/863167.html</guid>

					<description><![CDATA[在实际使用iframe的过程中，会遇到iframe高度的问题，对于iframe 自适应高度一直是难点，因为既要 ...]]></description>
										<content:encoded><![CDATA[<p>在实际使用iframe的过程中，会遇到iframe高度的问题，对于iframe 自适应高度一直是难点，因为既要考虑浏览器的兼容性，还要考虑同域、跨域的情况，下面就给大家介绍iframe 自适应高度的六种方法。</p>
<p><img decoding="async" alt="iframe 自适应高度的六种方法介绍" src="https://dz.cwhello.com/wp-content/uploads/2022/11/20221126043615-638197bf28e78.jpg" /></p>
<p><strong>前言：</strong></p>
<p>JS自适应高度其实就是设置iframe的高度，使其等于内嵌网页的高度，从而看不出来滚动条和嵌套痕迹，对于用户体验和网站美观起着重要作用。&middot;</p>
<p>如果内容是固定的，那么我们可以通过CSS来给它直接定义一个高度，同样可以实现上面的需求，当内容是未知或者是变化的时候，情况也各不一样。</p>
<p><strong>iframe 自适应高度的六种方法介绍：</strong></p>
<p><strong>一、iframe内容未知，高度可预测</strong></p>
<p>这个时候，我们可以给它添加一个默认的CSS的min-height值，然后同时使用JavaScript改变高度。常用的兼容代码有：&middot;</p>
<p>01// document.domain = &quot;caibaojian.com&quot;;02function setIframeHeight(iframe) {03if (iframe) {04var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;05if (iframeWin.document.body) {06iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;07}08}09};10window.onload = function () {11setIframeHeight(document.getElementById(&#039;external-frame&#039;));12};复制代码// document.domain = &quot;caibaojian.com&quot;;function setIframeHeight(iframe) {if (iframe) {var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;if (iframeWin.document.body) {iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;}}};window.onload = function () {setIframeHeight(document.getElementById(&#039;external-frame&#039;));};</p>
<p><strong>二、如果在同个顶级域名下，不同子域名之间互通信息</strong></p>
<p>设置document.domain=&ldquo;caibaojian.com&rdquo;，只要修改以上的iframe的ID即可了，或者你可以直接在iframe里面写代码，我们一般为了不污染HTML代码，建议使用上面的代码。</p>
<p>01&lt;iframe src=&quot;backtop.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; id=&quot;external-frame&quot; onload=&quot;setIframeHeight(this)&quot;&gt;&lt;/iframe&gt;复制代码&lt;iframe src=&quot;backtop.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; id=&quot;external-frame&quot; onload=&quot;setIframeHeight(this)&quot;&gt;&lt;/iframe&gt;</p>
<p><strong>三、多个iframe的情况下</strong></p>
<p>01&lt;script language=&quot;javascript&quot;&gt;02//输入你希望根据页面高度自动调整高度的iframe的名称的列表03//用逗号把每个iframe的ID分隔. 例如: [&quot;myframe1&quot;, &quot;myframe2&quot;]，可以只有一个窗体，则不用逗号。04//定义iframe的ID05var iframeids=[&quot;test&quot;];06//如果用户的浏览器不支持iframe是否将iframe隐藏 yes 表示隐藏，no表示不隐藏07var iframehide=&quot;yes&quot;;08function dyniframesize()09{10var dyniframe=new Array()11for (i=0; i&lt;iframeids.length; i++)12{13if (document.getElementById)14{15//自动调整iframe高度16dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);17if (dyniframe[i] &amp;&amp; !window.opera)18{19dyniframe[i].style.display=&quot;block&quot;;20if (dyniframe[i].contentDocument &amp;&amp; dyniframe[i].contentDocument.body.offsetHeight) //如果用户的浏览器是NetScape21dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight;22else if (dyniframe[i].Document &amp;&amp; dyniframe[i].Document.body.scrollHeight) //如果用户的浏览器是IE23dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;24}25}26//根据设定的参数来处理不支持iframe的浏览器的显示问题27if ((document.all || document.getElementById) &amp;&amp; iframehide==&quot;no&quot;)28{29var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i]);30tempobj.style.display=&quot;block&quot;;31}32}33}34if (window.addEventListener)35window.addEventListener(&quot;load&quot;, dyniframesize, false);36else if (window.attachEvent)37window.attachEvent(&quot;onload&quot;, dyniframesize);38else39window.onload=dyniframesize;40&lt;/script&gt;复制代码&lt;script language=&quot;javascript&quot;&gt;//输入你希望根据页面高度自动调整高度的iframe的名称的列表//用逗号把每个iframe的ID分隔. 例如: [&quot;myframe1&quot;, &quot;myframe2&quot;]，可以只有一个窗体，则不用逗号。//定义iframe的IDvar iframeids=[&quot;test&quot;];//如果用户的浏览器不支持iframe是否将iframe隐藏 yes 表示隐藏，no表示不隐藏var iframehide=&quot;yes&quot;;function dyniframesize(){var dyniframe=new Array()for (i=0; i&lt;iframeids.length; i++){if (document.getElementById){//自动调整iframe高度dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);if (dyniframe[i] &amp;&amp; !window.opera){dyniframe[i].style.display=&quot;block&quot;;if (dyniframe[i].contentDocument &amp;&amp; dyniframe[i].contentDocument.body.offsetHeight) //如果用户的浏览器是NetScapedyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight;else if (dyniframe[i].Document &amp;&amp; dyniframe[i].Document.body.scrollHeight) //如果用户的浏览器是IEdyniframe[i].height = dyniframe[i].Document.body.scrollHeight;}}//根据设定的参数来处理不支持iframe的浏览器的显示问题if ((document.all || document.getElementById) &amp;&amp; iframehide==&quot;no&quot;){var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i]);tempobj.style.display=&quot;block&quot;;}}}if (window.addEventListener)window.addEventListener(&quot;load&quot;, dyniframesize, false);else if (window.attachEvent)window.attachEvent(&quot;onload&quot;, dyniframesize);elsewindow.onload=dyniframesize;&lt;/script&gt;</p>
<p><strong>四、针对知道的iframe的ID调用</strong></p>
<p>01function iframeAutoFit(iframeObj){02setTimeout(function(){if(!iframeObj) return;iframeObj.height=(iframeObj.Document?iframeObj.Document.body.scrollHeight:iframeObj.contentDocument.body.offsetHeight);},200)03}复制代码function iframeAutoFit(iframeObj){setTimeout(function(){if(!iframeObj) return;iframeObj.height=(iframeObj.Document?iframeObj.Document.body.scrollHeight:iframeObj.contentDocument.body.offsetHeight);},200)}</p>
<p><strong>五、内容宽度变化的iframe高度自适应</strong></p>
<p>01&lt;iframe src=&quot;backtop.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; id=&quot;test&quot; onload=&quot;this.height=100&quot;&gt;&lt;/iframe&gt;02&lt;script type=&quot;text/javascript&quot;&gt;03function reinitIframe(){04var iframe = document.getElementById(&quot;test&quot;);05try{06var bHeight = iframe.contentWindow.document.body.scrollHeight;07var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;08var height = Math.max(bHeight, dHeight);09iframe.height = height;10console.log(height);11}catch (ex){}12}13window.setInterval(&quot;reinitIframe()&quot;, 200);14&lt;/script&gt;复制代码&lt;iframe src=&quot;backtop.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; id=&quot;test&quot; onload=&quot;this.height=100&quot;&gt;&lt;/iframe&gt;&lt;script type=&quot;text/javascript&quot;&gt;function reinitIframe(){var iframe = document.getElementById(&quot;test&quot;);try{var bHeight = iframe.contentWindow.document.body.scrollHeight;var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;var height = Math.max(bHeight, dHeight);iframe.height = height;console.log(height);}catch (ex){}}window.setInterval(&quot;reinitIframe()&quot;, 200);&lt;/script&gt;</p>
<p><strong>六、跨域下的iframe自适应高度</strong></p>
<p>跨域的时候，由于js的同源策略，父页面内的js不能获取到iframe页面的高度，需要一个页面来做代理。</p>
<p>方法如下：</p>
<p>假设www.a.com下的一个页面a.html要包含www.b.com下的一个页面c.html。</p>
<p>我们使用www.a.com下的另一个页面agent.html来做代理，通过它获取iframe页面的高度，并设定iframe元素的高度。&middot;</p>
<p>a.html中包含iframe：</p>
<p>01&lt;iframe src=&quot;http://www.b.com/c.html&quot; id=&quot;Iframe&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; style=&quot;border:0px;&quot;&gt;&lt;/iframe&gt;复制代码&lt;iframe src=&quot;http://www.b.com/c.html&quot; id=&quot;Iframe&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; style=&quot;border:0px;&quot;&gt;&lt;/iframe&gt;</p>
<p>在c.html中加入如下代码：</p>
<p>01&lt;iframe id=&quot;c_iframe&quot;  height=&quot;0&quot; width=&quot;0&quot;  src=&quot;http://www.a.com/agent.html&quot; style=&quot;display:none&quot; &gt;&lt;/iframe&gt;02&lt;script type=&quot;text/javascript&quot;&gt;03(function autoHeight(){04var b_width = Math.max(document.body.scrollWidth,document.body.clientWidth);05var b_height = Math.max(document.body.scrollHeight,document.body.clientHeight);06var c_iframe = document.getElementById(&quot;c_iframe&quot;);07c_iframe.src = c_iframe.src + &quot;#&quot; + b_width + &quot;|&quot; + b_height;  // 这里通过hash传递b.htm的宽高08})();09&lt;/script&gt;复制代码&lt;iframe id=&quot;c_iframe&quot;  height=&quot;0&quot; width=&quot;0&quot;  src=&quot;http://www.a.com/agent.html&quot; style=&quot;display:none&quot; &gt;&lt;/iframe&gt;&lt;script type=&quot;text/javascript&quot;&gt;(function autoHeight(){var b_width = Math.max(document.body.scrollWidth,document.body.clientWidth);var b_height = Math.max(document.body.scrollHeight,document.body.clientHeight);var c_iframe = document.getElementById(&quot;c_iframe&quot;);c_iframe.src = c_iframe.src + &quot;#&quot; + b_width + &quot;|&quot; + b_height;  // 这里通过hash传递b.htm的宽高})();&lt;/script&gt;</p>
<p>最后，agent.html中放入一段js：</p>
<p>01&lt;script type=&quot;text/javascript&quot;&gt;02var b_iframe = window.parent.parent.document.getElementById(&quot;Iframe&quot;);03var hash_url = window.location.hash;04if(hash_url.indexOf(&quot;#&quot;)&gt;=0){05var hash_width = hash_url.split(&quot;#&quot;)[1].split(&quot;|&quot;)[0]+&quot;px&quot;;06var hash_height = hash_url.split(&quot;#&quot;)[1].split(&quot;|&quot;)[1]+&quot;px&quot;;07b_iframe.style.width = hash_width;08b_iframe.style.height = hash_height;09}10&lt;/script&gt;复制代码&lt;script type=&quot;text/javascript&quot;&gt;var b_iframe = window.parent.parent.document.getElementById(&quot;Iframe&quot;);var hash_url = window.location.hash;if(hash_url.indexOf(&quot;#&quot;)&gt;=0){var hash_width = hash_url.split(&quot;#&quot;)[1].split(&quot;|&quot;)[0]+&quot;px&quot;;var hash_height = hash_url.split(&quot;#&quot;)[1].split(&quot;|&quot;)[1]+&quot;px&quot;;b_iframe.style.width = hash_width;b_iframe.style.height = hash_height;}&lt;/script&gt;</p>
<p>agent.html从URL中获得宽度值和高度值，并设置iframe的高度和宽度（因为agent.html在www.a.com下，所以操作a.html时不受JavaScript的同源限制）</p>
<p>今天说说iframe 自适应高度的六种方法就给大家介绍到这里了，希望可以帮助到广大的码农们，不要再头疼了。。。</p>

<p><img src="https://www.gxjlyf.com/postviews/863167.png" /></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>小编分享AutoCAD2016快速入门：添加文字</title>
		<link>https://www.gxjlyf.com/812202.html</link>
		
		<dc:creator><![CDATA[bafang18]]></dc:creator>
		<pubDate>Mon, 07 Nov 2022 16:22:28 +0000</pubDate>
				<category><![CDATA[PC教程]]></category>
		<category><![CDATA[文字]]></category>
		<category><![CDATA[高度]]></category>
		<guid isPermaLink="false">https://www.chuwenyu.com/812202.html</guid>

					<description><![CDATA[很多时候，我们在使用AutoCAD绘制图纸的时候，都会添加一些文字，对图纸的一些重要内容作出说明。在CAD中存 ...]]></description>
										<content:encoded><![CDATA[<p>很多时候，我们在使用AutoCAD绘制图纸的时候，都会添加一些文字，对图纸的一些重要内容作出说明。在CAD中存在两种文字一种是多行文字，另一种则是单行文字。那么，AutoCAD2016怎么添加多行文字及单行文字呢？下面，我们一起往下看看。</p>
<p><strong>方法步骤</strong></p>
<p><strong>一、单行文字</strong></p>
<p>顾名思义，单行文字，一个单行文字只有一行，在书写时可以一次性写多行，但每一行都一个独立的文字对象。单行文字输入和编辑都比较简单，常用语简单的文字注释、图框标题栏、表格文字等等。</p>
<p>1、在命令面板或工具栏单击单行文字按钮，或输入DT后回车，启动单行文字功能。</p>
<p><img decoding="async" alt="AutoCAD2016快速入门：添加文字" src="https://dz.cwhello.com/wp-content/uploads/2022/11/20221107162226-636930c2a11c2.jpg" /></p>
<p>创建单行文字的时候注意观察命令行的提示，因为单行文字会提示指定位置、字高、旋转角度等，需要按照提示进行相应操作，不能执行命令后直接输入文字。</p>
<p>执行命令后，命令行会提示：指定文字的起点或 ［对正（J）/样式（S）］：</p>
<p>这是告诉我们可以指定文字的起点，或输入参数来设置文字的对正方式和样式。我们先不管后面的选项，直接开始创建文字。</p>
<p>2、在图中某个文字单击确定文字的起点。</p>
<p>此时命令行提示：指定高度 《2.5000》：</p>
<p>这是告诉我们文字的默认高度是2.5，如果我们要修改文字高度，可以直接输入高度，也可以在图中通过取两个点来确定文字高度。</p>
<p>3、回车，使用默认文字高度。</p>
<p>命令行提示：指定文字的旋转角度 《0》：</p>
<p>通常情况下文字不用旋转，可以直接回车，如果文字有一定倾斜角度，可以输入文字旋转角度，或在图中拾取两点来确定文字的旋转角度。</p>
<p>4、回车，这次我们看到光标回到了我们刚才在图面上指定的文字起点处，如下图所示。</p>
<p><img decoding="async" alt="AutoCAD2016快速入门：添加文字" src="https://dz.cwhello.com/wp-content/uploads/2022/11/20221107162226-636930c2cf495.jpg" /></p>
<p>此时就可以输入文字了。</p>
<p>5、输入英文&ldquo;TEXT&rdquo;后，按空格键换行，如下图所示。</p>
<p><img decoding="async" alt="AutoCAD2016快速入门：添加文字" src="https://dz.cwhello.com/wp-content/uploads/2022/11/20221107162227-636930c3089fd.jpg" /></p>
<p>6、再输入中文&ldquo;文字&rdquo;，鼠标在屏幕上其他位置单击，如下图所示。</p>
<p><img decoding="async" alt="AutoCAD2016快速入门：添加文字" src="https://dz.cwhello.com/wp-content/uploads/2022/11/20221107162227-636930c32fc2d.jpg" /></p>
<p>在有些版本的CAD里在输入中文后会出现如下图所示的现象。</p>
<p><img decoding="async" alt="AutoCAD2016快速入门：添加文字" src="https://dz.cwhello.com/wp-content/uploads/2022/11/20221107162227-636930c35ac3e.jpg" /></p>
<p>TEXT可以正常显示，但中文的&ldquo;文字&rdquo;就会显示为问号。这是什么原因呢？这是因为当前使用的字体不支持中文，所以就出现了问号。</p>
<p>7、输入英文&ldquo;CAD&rdquo;，按回车键两次，结束文字输入。</p>
<p>在输入完文字后，有可能出现这样的情况：文字突然变的很小。出现这种状况不要觉得奇怪，当文字在当前窗口中高度太小时，CAD为了让我们能看得见文字，就自动将他放大了，等结束创建后，文字就恢复成正常的尺寸来显示。</p>
<p><strong>二、多行文字</strong></p>
<p>对于成段或成篇的文字，多行文字可很好地满足要求。比如，常用的技术说明文字。</p>
<p>1、单击多行文字按钮，或输入T后回车，启动多行文字功能。</p>
<p>2、在图中指定两个点，来指定文本范围。</p>
<p><img decoding="async" alt="AutoCAD2016快速入门：添加文字" src="https://dz.cwhello.com/wp-content/uploads/2022/11/20221107162227-636930c384141.jpg" /></p>
<p>3、在文字区域中输入文字，必要时可使用回车键换行。完成内容输入后，单击文本编辑面板上的&ldquo;OK&rdquo;按钮，完成多行文本输入。</p>
<p>如果你的CAD版本在单行文字输入中文时显示为问号，会发现在输入多行文字的时候不会显示为问号，这是因为在多行文字，如果当前字体不支持中文，在输入中文时，CAD会自动使用宋体。</p>

<p><img src="https://www.gxjlyf.com/postviews/812202.png" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
