javascript - 试图让图像以 HTML 形式发出警报

标签 javascript html dom

我对 HTML 和编码还很陌生;我正在开发一个围绕游戏的非常基本的网页。虽然这可能是其他地方的答案,但我无法得到直接的答案。请记住,我是这个 block 的新手,所以我不会理解更高级的术语。

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>

当我单击图像“Invoker_Icon.png”时,它不会创建警告框。

提前谢谢你,这一直困扰着我。

谢谢,

托马斯

最佳答案

您需要通过添加括号实际调用该函数。

您的处理程序属性代码实际上没有执行任何操作。

关于javascript - 试图让图像以 HTML 形式发出警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38599201/

相关文章:

javascript - 使用javascript扩展/缩小图像?

html - 使用angularjs指令将绝对div与另一个div的右边缘对齐

javascript - 有没有一种自动方法来检测 html 元素(标签)何时出现在屏幕上?

jquery - 如何让textarea中的文字保持在顶部?

javascript - 为什么当我创建 10,000 个元素时,内存使用量没有增长?

ajax - 基于 DOM 的数据存储,最佳选择/性能?

javascript - 尝试使用 inDesign javascript 使文本字段不可打印

javascript - 如何获取“检查元素”中显示的网站数据,而不是“查看页面源”中显示的网站数据?

javascript - 单击表格按钮即可获取动态创建的表格单元格值

jquery - HTML5 视频 : Recognize a new source