开发者

transform all text on page into Lower Case

I am looking for a method that transforms all text present on the page into LowerCase. I was reading an review and unfortunatelly the person has posted in all uppercase. I tried to read but all uppercase text is harder to read, not to mention it is considered shouting on the web.

I know javascript have methods such as string.toLowerCase() & string.replace But I can't figure it out.

so looking for some kind of JavaScript bookmarklet that converts all text into LowerCase on a already loeaded html page.

[Edit]

Found the solution, here javascript code to change the css style text-transform: lowercase for entire page:

var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (styleEle开发者_开发知识库ment.styleSheet) {
  styleElement.styleSheet.cssText = "* {  text-transform: lowercase }";
} else {
  styleElement.appendChild(document.createTextNode("* {  text-transform: lowercase; }"));
}
document.getElementsByTagName("head")[0].appendChild(styleElement);


If you are simply wanting to change html text to lowercase, you could do it with css.

text-transform: lowercase;

Would that work?


Instead of turning everything to lowercase, you could set up a bookmarklet, which when clicked, will record the position of your next click. From the position you can use the document.elementFromPoint(x, y) method to get the actual dom node. This dom node will probably be a <p> tag or a <div> tag. Do whatever you want now!

May be an overkill though!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜