由买买提看人间百态

topics

全部话题 - 话题: innerhtml
1 (共1页)
j***n
发帖数: 301
1
来自主题: Programming版 - innerHtml的问题
【 以下文字转载自 BuildingWeb 讨论区 】
发信人: jamen (jamen), 信区: BuildingWeb
标 题: innerHtml的问题
发信站: BBS 未名空间站 (Fri Dec 12 01:07:39 2008), 转信
一个dom节点的innerHtml += 另外一个字符串,能够立即的显示出来么?(感觉IE7下不
能够立即显示)
j***n
发帖数: 301
2
来自主题: BuildingWeb版 - innerHtml的问题
一个dom节点的innerHtml += 另外一个字符串,能够立即的显示出来么?(感觉IE7下不
能够立即显示)
w******t
发帖数: 16937
3
来自主题: Living版 - 想设计个logo
分特,想看专业的?
看这个。声明:因为网络安全原因,我删去了一些必须删去的内容。
http://schema.org/WebPage">Google


<tr><td class="zt-author">m*****h<br />发帖数: 18</td><td width=80% class="zt-bg"><div id="post38" style="position:relative"><div class="zt-counter">38</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">DotNet版</span> - <a href="/zhuti/DotNet/31101781/#post1" style="font-size:1.1em">please help me...</a></div><span>I have a user control used to dynamically display web contents. To make the<br /> web content editable in the browser I set the contenteditable= true in the <<br /> div> tag.<br /> when the uswer control is loaded, set div.innerhtml as the content returned<br /> from the database. the problem i have right now is after editing the content<br /> in the broswer, i can't get the new content. although i can get the new<br /> value in the javascript, i need to save the new content to the database. so<br /> i have to do it in the code behind.</span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">m*****n<br />发帖数: 266</td><td width=80% class="zt-bg2"><div id="post39" style="position:relative"><div class="zt-counter">39</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Linux版</span> - <a href="/zhuti/Linux/31217463/#post2" style="font-size:1.1em">KDE跟GNOME对着干呀。</a></div><span>// ==UserScript==<br /> // @name blockID<br /> // @tag a*****i@mitbbs.com<br /> // @description Block mitbbs ID<br /> // @include http://*.mitbbs.com/*<br /> // ==/UserScript==<br /> var allElements, thisElement;<br /> allElements = document.getElementsByTagName('*');<br /> var pattern = /ARod|Beckett/;<br /> for (var i=0; i<allElements.length; i++) {<br /> thisElement = allElements[i]; <br /> if (thisElement.className =="jiawenzhang-type" ) { <br /> if (thisElement.innerHTML.search(pattern) != -1) {<br /> </span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">k*k<br />发帖数: 508</td><td width=80% class="zt-bg"><div id="post40" style="position:relative"><div class="zt-counter">40</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/17686866/#post7" style="font-size:1.1em">请教:JavaScript怎么复制一个node(含子节点)? (转载)</a></div><span>返回的是一个字串么?试试看这样<br /> var node = window.document.createElement('body');<br /> node.innerHTML=<the string you got>;<br /> insert the node.</span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">f*****Q<br />发帖数: 1912</td><td width=80% class="zt-bg2"><div id="post41" style="position:relative"><div class="zt-counter">41</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31164778/#post2" style="font-size:1.1em">innerHtml的问题</a></div><span>浏览器一般每秒钟刷新次数不会超过10次。所以会有一个0.1到0.2秒的滞后。<br /> <br /> 下不</span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">j***n<br />发帖数: 301</td><td width=80% class="zt-bg"><div id="post42" style="position:relative"><div class="zt-counter">42</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31164778/#post3" style="font-size:1.1em">innerHtml的问题</a></div><span>不止<br /> for(var i = 1; i <= 4; i ++){<br /> document.writeln("this is line " + i + "<br>");<br /> sleeep(1000);<br /> }<br /> 基本上是一次显示出所有的东西</span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">f*****Q<br />发帖数: 1912</td><td width=80% class="zt-bg2"><div id="post43" style="position:relative"><div class="zt-counter">43</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31164778/#post4" style="font-size:1.1em">innerHtml的问题</a></div><span>dom一般是在从函数体退出之后才会更新。<br /> 道理和每几百毫秒刷新一次一样。<br /> 你可以把这四个循环用setInteval或者settimeout来做。</span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">X****r<br />发帖数: 3557</td><td width=80% class="zt-bg"><div id="post44" style="position:relative"><div class="zt-counter">44</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31185527/#post2" style="font-size:1.1em">请教一个javascript的问题</a></div><span>很容易啊,我这就写了两个bookmarklet可以显示网页上所有的注释作为HTML或者Text<br /> <a href="javascript:(function(){function f(n){if(n){var<br /> m=n.nextSibling;if(n.nodeType==8){var<br /> p=n.parentNode,d=document.createElement('div');d.innerHTML=n.nodeValue;w<br /> hile(d.firstChild)p.insertBefore(d.firstChild,n);p.removeChild(n)}else{f<br /> (n.firstChild)}f(m)}};f(document.body.firstChild)})()">Uncomment as<br /> HTML</a><br /> <a href="javascript:(function(){function f(n){if(n){var<br /> m=n.nextSibling;if(n.nodeType==8){var<br /> p=n.parentNode;p.insertBefore(document.cr</span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">z***e<br />发帖数: 5393</td><td width=80% class="zt-bg2"><div id="post45" style="position:relative"><div class="zt-counter">45</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31203093/#post5" style="font-size:1.1em">PHP/JSP/ASP等页面语言应该被慢慢抛弃了吧?</a></div><span>对啊,但是目前的ajax应用也一般只是针对页面一小部分,而不是全部,很多还是在<br /> server生成页面的。<br /> 比如说,facebook聊天是ajax,但是newsfeed应该就是静态生成的---你打开facebook<br /> ,点坐上角facebook图标,会看到除了最左边一栏,整个右边大半页面都有个刷新过程,这应<br /> 该就是在backend生成的右边页面,然后返回(大概是个iframe).<br /> 按照我的想法和ajax的习惯,你不应该看到这个页面刷新过程(直接替换DOM里面的<br /> innerHTML不应该看到刷新的过程).</span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">X****r<br />发帖数: 3557</td><td width=80% class="zt-bg"><div id="post46" style="position:relative"><div class="zt-counter">46</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31203093/#post7" style="font-size:1.1em">PHP/JSP/ASP等页面语言应该被慢慢抛弃了吧?</a></div><span>嗯,我五年前设计开发的产品就是你说的这样的,好处是所有的UI只需要写Javascript<br /> 就可以,开发效率高并且容易维护。不过现在反而不这么做了。<br /> 目前有两个现实问题:<br /> 1.服务器端的计算比客户端快的多。对于许多用户来说,在浏览器里的计算效率很低。<br /> 举个例子,现在大概还有10%的用户在使用IE 6。而且额外的一个server round trip<br /> 也会降低效率。<br /> 2.搜索引擎并不运算(大部分)Javascript,对页面的可搜索性大大不利。<br /> 而且直接替换DOM里面的innerHTML的确有刷新的过程,因为浏览器并不知道你早先的<br /> HTML只是个空架子没有实际内容。<br /> 其实完全可以用一套服务器端和客户端通用的模板系统,甚至在服务器端运行<br /> Javascript,<br /> 来兼得开发效率和运行效率的好处。现在我就是在用服务器端和客户端通用的模板系统。<br /> 不过老实说,搞熟了以后,同时使用客户端的和服务器端的两套语言也没多大影响。<br /> <br /> facebook<br /> 程,这应</span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">h**i<br />发帖数: 712</td><td width=80% class="zt-bg2"><div id="post47" style="position:relative"><div class="zt-counter">47</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31206015/#post1" style="font-size:1.1em">如何在HTML里引用并设置其他标签的属性?</a></div><span>不用JS的话,比如<span id="time"> 0:00 </span><br /> 想改变0:00的话是不是 <@time.innerHTML = "1:20"></span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">w*******s<br />发帖数: 96</td><td width=80% class="zt-bg"><div id="post48" style="position:relative"><div class="zt-counter">48</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31221099/#post1" style="font-size:1.1em">Javascript: dynamicly enable draggable id?</a></div><span>I want to use Javascript to change HTML id:<br /> var td1 = document.createElement("td");<br /> td1.ondragstart="drag(event)";<br /> but it didn't work out. What's wrong?<br /> <!DOCTYPE HTML><br /> <html><br /> <head><br /> <style type="text/css"><br /> #div1 {width:350px;height:70px;padding:10px;border:1px solid #aaaaaa;}<br /> </style><br /> <script type="text/javascript"><br /> function onload()<br /> {<br /> var tr1=document.getElementById("tr1");<br /> var td1 = document.createElement("td");<br /> td1.draggable="true";<br /> td1.ondragstart="drag(event)"; =======> This statemen... <a href="/zhuti/Programming/31221099/#post1">阅读全帖</a></span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">w*s<br />发帖数: 7227</td><td width=80% class="zt-bg2"><div id="post49" style="position:relative"><div class="zt-counter">49</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31342409/#post6" style="font-size:1.1em">Newbie javascript question: change radio button updates textbox message</a></div><span>Why it's not working for me, any suggestions appreciated.<br /> js1.js----------------------------------<br /> function button_click()<br /> {<br /> document.querySelector("#msg').innerHTML = 'You chosed' + document.<br /> querySelector('input[name="choice"]:checked').value + '.';<br /> }<br /> my.html----------------------------------------<br /> <!DOCTYPE html><br /> <html><br /> <head><br /> <meta charset="utf-8"><br /> <title>Raido</title><br /> <script type="text/javascript" language="javascript" src="js1.js"></<br /> script><br /> </head><br /> <body><br /> <input type=... <a href="/zhuti/Programming/31342409/#post6">阅读全帖</a></span></div></td></tr></table></td> </tr> <tr> <td><table style="margin-top:0"><tr><td class="zt-author">l**********n<br />发帖数: 8443</td><td width=80% class="zt-bg"><div id="post50" style="position:relative"><div class="zt-counter">50</div><div style="margin-bottom:20px;font-size:1.1em"><span style="font-weight:bold">来自主题: </span><span class="board">Programming版</span> - <a href="/zhuti/Programming/31344283/#post8" style="font-size:1.1em">replace document body,but js does not run</a></div><span>如果是js,应该放在JavaScript tag里吧?然后再append到body。但是jquey应该可以<br /> 自动帮你做这个。另外你似乎得用body.append或者innerHTML</span></div></td></tr></table></td> </tr> </tbody></table></div> </div> <div id="pager" style="margin-top:25px"> <div><table class="searchpages" style="float: right"><tbody><tr> <td></td> <td>1</td> <td></td> <td>(共1页)</td> </tr> </tbody></table></div> </div> </div> <span class="anchor" id="line-3"></span><span class="anchor" id="bottom"></span></div><div id="pagebottom"></div></div><div class="sidebar"><div dir="ltr" id="SideBar.sidebar" lang="zh"><span class="anchor" id="SideBar.top"></span> <span class="anchor" id="SideBar.line-1"></span><span class="anchor" id="SideBar.line-2"></span><p class="line867"><div id="rankings"><h3>未名新帖统计<span>//&nbsp;7月16日</span></h3><div><table width=100%><tr><th width=10% align=left>#</th><th width=50% align=left>版面</th><th width=40% align=left>帖数(主题数)</th></tr><tr><td>-</td><td>全站</td><td>4871 (796)</td></tr><tr><td>1</td><td><a title="军事天地" href="/board/Military/">Military</a></td><td>3777 (569)</td></tr><tr><td>2</td><td><a title="股海弄潮" href="/board/Stock/">Stock</a></td><td>341 (51)</td></tr><tr><td>3</td><td><a title="肚皮舞运动" href="/board/Joke/">Joke</a></td><td>117 (17)</td></tr><tr><td>4</td><td><a title="史海钩沉" href="/board/History/">History</a></td><td>116 (3)</td></tr><tr><td>5</td><td><a title="车轮上的传奇" href="/board/Automobile/">Automobile</a></td><td>100 (9)</td></tr><tr><td>6</td><td><a title="美国新闻" href="/board/USANews/">USANews</a></td><td>55 (9)</td></tr><tr><td>7</td><td><a title="人到中年" href="/board/Midlife/">Midlife</a></td><td>45 (1)</td></tr><tr><td>8</td><td><a title="焦点新闻" href="/board/Headline/">Headline</a></td><td>41 (41)</td></tr><tr><td>9</td><td><a title="梦里花落知多少" href="/board/Dreamer/">Dreamer</a></td><td>33 (13)</td></tr><tr><td>10</td><td><a title="二手市场" href="/board/FleaMarket/">FleaMarket</a></td><td>32 (20)</td></tr><tr><td>11</td><td><a title="家居生活" href="/board/Living/">Living</a></td><td>30 (7)</td></tr></table><p>* 这里只显示发帖超过25的版面,努力灌水吧:-)</p></div></div> <span class="anchor" id="SideBar.line-3"></span><div id="matched_content" style="margin: 5px 2px 5px 2px"></div> <span class="anchor" id="SideBar.line-4"></span> <h3 id="SideBar.A.2BU4ZT8k4KdoROylkp-">历史上的今天</h3> <span class="anchor" id="SideBar.line-5"></span><p class="line867"><div class="BlikiSummary" style="margin-bottom:1.2em;margin-left:0.5em"><ol><li><a href="/zhuti/ChineseClassics/31268413/">faintcat妹妹看进来~~</a> 发表于12年前.</li><li><a href="/zhuti/EB23/31380293/">NSC, PD 1/7/2007, EB2, ...</a> 发表于11年前.</li><li><a href="/zhuti/FleaMarket/35696181/">[FBA求购]MJVE2 758 MJVM2 ...</a> 发表于6年前.</li><li><a href="/zhuti/Parenting/31948559/">老生常谈,归与不归</a> 发表于10年前.</li><li><a href="/zhuti/board/31486231/">【申请】Seattle西雅图 版版主——申请人...</a> 发表于9年前.</li><li><a href="/zhuti/NextGeneration/36332471/">宝宝出生,头骨骨折,求祝福</a> 发表于9年前.</li><li><a href="/zhuti/ClassicalMusic/31210935/">求推荐舒缓优美的古典音乐</a> 发表于11年前.</li><li><a href="/zhuti/PhotoGear/34338217/">百分之一的北京人上北大 中国网友愤怒(转载)</a> 发表于10年前.</li><li><a href="/zhuti/pets/31825797/">新人带狗狗Bailey来报道</a> 发表于12年前.</li><li><a href="/zhuti/Football/31468183/">全世界最有价值的运动队</a> 发表于10年前.</li><li><a href="/zhuti/Automobile/35426999/">请问大切诺基的质量如何</a> 发表于6年前.</li><li><a href="/zhuti/_RuS/23459405/">TNND,军版全是BKC</a> 发表于15年前.</li><li><a href="/zhuti/_LoTaYu/31206385/">Inception</a> 发表于12年前.</li><li><a href="/zhuti/Seattle/32526849/">微软的有些家属可真恶心,为了卖保险脸都不要了</a> 发表于10年前.</li><li><a href="/zhuti/Military/39967953/">每周坐高铁的苦逼来说说感受吧!!</a> 发表于9年前.</li></ol></div> <span class="anchor" id="SideBar.line-6"></span> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2229050667028251" crossorigin="anonymous"></script> <!-- SidebarW1 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2229050667028251" data-ad-slot="2711874079" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <span class="anchor" id="SideBar.line-7"></span><span class="anchor" id="SideBar.bottom"></span></div><div id="sidebar-end"></div></div></div><div class="footer"><span class="license">除非另有声明,本站内容采用Creative Commons BY-NC-SA 3.0协议进行许可,转载请注明来自<a href="/">未名观察</a> - <a href="/PrivacyPolicy">隐私政策</a></span><span class="time" lang="zh" dir="ltr">2017-12-02 11:50:45由<span title="admin"><a href="/admin" title="admin">admin</a></span>编辑</span> </div> <script> var _gaq=[['_setAccount','UA-18482428-3'],['_trackPageview'],['_trackPageLoadTime']]; (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; s.parentNode.insertBefore(g,s)}(document,'script')); </script> <script type="text/javascript" src="http://s.skimresources.com/js/27394X857871.skimlinks.js"></script> </body> </html>