我错误地写了什么? [英] What have I written wrongly?
本文介绍了我错误地写了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用javascript更改段落的文本,但我的电脑上似乎没有任何变化。有什么问题?
I am attempting to change the text of a paragraph with javascript as shown but nothing seem to be changing on my PC. What is wrong?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
function ChangeText(Mynumber)
{
return 'Paragraph Changed';
}
function Reset()
{
document.getElementById("demo").innerHTML = ChangeText(1)';
}
</script>
</head>
<body>
<h1>My Web Page</h1>
<p id="demo">A Paragraph</p>
<button type="button" onclick="Reset()">Try it</button>
</body>
</html>
推荐答案
你在这里写了一个小错字:
You made a small typo here:
document.getElementById("demo").innerHTML = ChangeText(1)';
分号前面有一个引号,不能出现在那里。
There is a single quote before the semicolon, which mustn't be there.
这篇关于我错误地写了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文