Skip to main content
March 17, 2011
Question

Can I replace string with a variable in innerhtml?

  • March 17, 2011
  • 1 reply
  • 458 views

Hi,

I have the following script:

function change2(e)
{
var userInput = document.getElementById(e).innerHTML;
userInput++;
document.getElementById(e).innerHTML = userInput;
}
</script>

being called via:

echo "<a href=\"#\"><img src=\"./../Up.JPG\" border=\"0\" onclick=\"change2('".$idkey."');\"></a>";
echo " ".$num_rows1."</form>";

I basically want 'e' to be dynamic accepting the id passed into it.

Thanks in advance.

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

March 17, 2011

sorry, had a typo. resolved.