I m允许用户选择载于<代码><div></div>的案文并将其改为黑体字。 换言之,从<代码><div> ;该文本是某些文本的复制件;/div> to <div>this is <b>some</b> text</div>
。 除此以外,所有方面都在发挥作用,但当我把div.inner/2006/2改为、b>、some<、/b>text
、<、b>、b>、标签被显示给用户,而不是作为“超”和显示、大胆。 这一切都发生在客户的 Java印中。
我如何迫使浏览器向用户提供标签,而不是向用户披露这些标签?
每项要求,此处为法典......
页: 1
<div id="blob">
One simple, but not very efficient implementation of a dictionary is a linked
list. In this implementation all operations take linear time in the worst case
(and even in the average case), assuming that insertions first check whether the
item is in the current list. A more scalable implementation of a dictionary is a
balanced search tree. In this lecture note we present two even more efficient data
structures based on hashing.
</div>
Javascript...
tagText(document.getElementById("blob"),"<b>","</b>");
......
//======================================================================
function tagText(el,tagstart,tagend)
{
var range = window.getSelection().getRangeAt(0);
var rtxt = range.startContainer.textContent;
var rlen = rtxt.length;
var start = range.startOffset;
var stop = range.endOffset;
var result = rtxt.substring(0,start) + tagstart + rtxt.substring(start,stop) + tagend + rtxt.substring(stop,rlen);
// el.innerHTML = result;
range.startContainer.textContent = result;
var txt = el.innerHTML;
el.innerHTML = txt;
}
//======================================================================
看一看四点:通过火力推来的内温超显示,标签越出<b>
而不是<b>
。