Home >Web Front-end >JS Tutorial >The introduction content exceeds part of the text and hides the omitted special effects (can be displayed)_Text special effects

The introduction content exceeds part of the text and hides the omitted special effects (can be displayed)_Text special effects

WBOY
WBOYOriginal
2016-05-16 18:01:041320browse

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<script> (function(){ var o = document.getElementById("hutia"); var s = o.innerHTML; var p = document.createElement("span"); var n = document.createElement("a"); p.innerHTML = s.substring(0,100); n.innerHTML = s.length > 100 ? "..." : ""; n.href = "###"; n.onclick = function(){ if (n.innerHTML == "..."){ n.innerHTML = "收起"; p.innerHTML = s; }else{ n.innerHTML = "..."; p.innerHTML = s.substring(0,100); } } o.innerHTML = ""; o.appendChild(p); o.appendChild(n); })(); </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn