Widget:Highlight: Difference between revisions
Jump to navigation
Jump to search
((by SublimeText.Mediawiker)) |
((by SublimeText.Mediawiker)) |
||
Line 1: | Line 1: | ||
<script> | <script> | ||
function highlight(text) { | function highlight(text) { | ||
var inputText = document.getElementById(" | var inputText = document.getElementById("bodyContent"); | ||
var innerHTML = inputText.innerHTML; | var innerHTML = inputText.innerHTML; | ||
var index = innerHTML.indexOf(text); | var index = innerHTML.indexOf(text); |
Revision as of 16:38, 17 June 2021
<script> function highlight(text) { var inputText = document.getElementById("bodyContent"); var innerHTML = inputText.innerHTML; var index = innerHTML.indexOf(text); if (index >= 0) { innerHTML = innerHTML.substring(0,index) + "" + innerHTML.substring(index,index+text.length) + "" + innerHTML.substring(index + text.length); inputText.innerHTML = innerHTML; } } window.onload = highlight(""); </script>