Jump to content

innerhtml


dreamwest

Recommended Posts

the innerHTML needs converting into  an Integer / Float etc before a mathimatical function can be performed.

Try:

<script>
function up(){
var field = document.getElementById("cnt").innerHTML;
var value1  = parseInt(field);
 document.getElementById("cnt").innerHTML =value1 +1;

}
</script>

<span id='cnt'>0</span>
<span style='cursor:pointer;' onclick='up(); '>Go up</span>

Link to comment
https://forums.phpfreaks.com/topic/230901-innerhtml/#findComment-1188649
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.