I have a label control with text Present: 1/1(2%)
I want to change via script to Present 1(2%)
When testing, I can get the string Present: 1 but I can't get the other half (2%) .
What am I missing?
document.getElementById("Label2").innerHTML = y.innerHTML.substring(0, nStart); <--- Gives me Present: 1
document.getElementById("Label2").innerHTML = y.innerHTML.substring(nEnd,5); <--- Gives me nt: 1/1
document.getElementById("Label2").innerHTML = y.innerHTML.substring(0, nStart) + y.innerHTML.substring(nEnd,5) <-- Gives me Present: 1nt: 1/1
I want to change via script to Present 1(2%)
When testing, I can get the string Present: 1 but I can't get the other half (2%) .
What am I missing?
Code:
<script>
//var x = document.getElementById("Label1");
//document.getElementById("Label1").innerHTML = x.innerHTML.substring(0, 6);
var y = document.getElementById("Label2");
var nStart = y.innerHTML.indexOf("/")
var nEnd = y.innerHTML.indexOf("(")
document.getElementById("Label2").innerHTML = y.innerHTML.substring(0, nStart);
document.getElementById("Label2").innerHTML = y.innerHTML.substring(nEnd,5);
document.getElementById("Label2").innerHTML = y.innerHTML.substring(0, nStart) + y.innerHTML.substring(nEnd,5)
</script>
document.getElementById("Label2").innerHTML = y.innerHTML.substring(nEnd,5); <--- Gives me nt: 1/1
document.getElementById("Label2").innerHTML = y.innerHTML.substring(0, nStart) + y.innerHTML.substring(nEnd,5) <-- Gives me Present: 1nt: 1/1