Widget:Highlight: Difference between revisions

From Rangjung Yeshe Wiki - Dharma Dictionary
Jump to navigation Jump to search
((by SublimeText.Mediawiker))
((by SublimeText.Mediawiker))
Line 9: Line 9:
}
}
}
}
window.onload = highlight(<!--{$term}-->);
window.onload = highlight("<!--{$term}-->");
</script>
</script>

Revision as of 16:37, 17 June 2021

<script> function highlight(text) { var inputText = document.getElementById("content"); 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>