我对HTML和编码很陌生;我正在开发一个围绕游戏的基本网页。虽然这可能是其他地方的答案,但我还没能得到一个直截了当的答案。请记住,我是该块的新手,所以我不会理解更高级的术语。
function myFunction {
alert("Invoker is a ranged intelligence hero who is very difficult to master. He is unique in that he possesses a total of 14 abilities in his arsenal; three of them - Quas, Wex, and Exort - are reagents and one is his special ultimate Invoke. The three abilities he learns throughout leveling up can have three instances, which serve as the basic ingredients or components for him to create a new ability using his ultimate. Once the reagents or elements are combined, he can invoke one out of ten different abilities. All of his invoked abilities are capable of a multitude of actions, from damaging enemies to aiding his allies, and even saving himself from danger. His three reagents can be upgraded up to level 7 which determines the power and potency of his invoked abilities, making it more powerful than an ordinary spell. Because of this, he can be played in almost any role possible. Invoker can be a carry, semi-carry, ganker, pusher, initiator or even support. His three reagents provide passive attributes with each level, and each instance of his reagents provides a passive bonus, allowing for specialization at early levels and situational boosts at later levels. His extremely flexible nature allows him to use many different combinations of items effectively but also make him dependent on solid builds and a good gold advantage. Because of the extra points needed to level his three reagents, Invoker also has a special Attribute Bonus ability at level 25 that allows him to gain 6 points in all stats.");
}

<html>
<head>
<title>ICT</title>
<link rel="stylesheet" type="text/css"href="Style 1.css">
<style type="text/css">
</style>
<script type="text/javascript" src="Dota2 Heroes Alarm.js">
</script>
</head>
<body bgcolor=blue>
<div style="position: absolute; left: 10px; top: 40px;">
<img src="Invoker_Icon.png" width="32" height="32" onclick="myFunction;" />
</div>
&#13;
当我点击图片&#34; Invoker_Icon.png&#34;时,它不会创建警告框。
提前谢谢你,它一直困扰着我。
谢谢,
托马斯
答案 0 :(得分:2)
您需要通过添加括号实际调用该函数。
您的处理程序属性代码实际上没有做任何事情。
答案 1 :(得分:0)
您没有包含()
:
onclick="myFunction;"
所以你实际上并没有调用你的功能。您只是将函数内部表示的引用添加到onclick中,这并没有做任何事情。这就像1;
- 也没有做任何事情。它只是在那里1
。
尝试
onclick="myFunction();"