Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can I replace string with a variable in innerhtml?

Guest
Mar 17, 2011 Mar 17, 2011

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.

TOPICS
Server side applications
456
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 17, 2011 Mar 17, 2011
LATEST

sorry, had a typo. resolved.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines