简体   繁体   English

更改innerHTML不起作用

[英]Change innerHTML doesn't work

Well I have that code: 好吧,我有那个代码:

<script>

function changeInner(id, inner) {
 document.getElementById(id).innerHTML = "<textarea>" + inner + "</textarea>"
}

</script>

<span id="edit" onlick="javascript:changeInner('edit', 'More text in a Textarea!');">Some text!</span>

Why it doesn't work? 为什么不起作用? It's too simple, and it doesn't work, I don't know why... 它太简单了,它不起作用,我不知道为什么...

You have a typo in your html markup. 您的html标记中有错字。 Changing onlick to onclick makes everything work. onlick更改为onclick可使一切正常。

<span id="edit" onclick="...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM