Monday, December 19, 2016

remove symbol


symbol to remove: b
a,b,c,d,e
remove symbol

<div style="color:violet">symbol to remove: <span id="atnbg20161219m1139toremove" style="font-size:2em;color:goldenrod">a</span></div>
<div id="atnbg20161219m1139list" style="color:burlywood">a,b,c,d,e</div>
<div><a href="javascript:atnbg20161219m1139()" style="color:greenyellow;font-size:2em">remove symbol</a></div>
<script>
function atnbg20161219m1139() {
var str = document.getElementById("atnbg20161219m1139toremove").innerHTML
var list = document.getElementById("atnbg20161219m1139list")
var array = list.innerHTML.split(",")
var thisq = "no"
var this = 0
while (thisq === "no") {
if (array[this] === str) {var that = this;thisq = "yes"}
this = this + 1}
if (thisq === "yes") {array.splice(that,1)}
//list.innerHTML = array.toString()
list.innerHTML = list.innerHTML + that}
</script>

No comments:

Post a Comment