有没有办法将这个JavaScript添加到HTML文件中

Is there a way to add this JavaScript to an HTML file?

本文关键字:添加 HTML 文件 JavaScript 有没有      更新时间:2023-09-26

我可以将这样的JavaScript代码添加到HTML文件中吗?怎样

fill(0, 0, 0);
ellipse(200, 200, 375, 375);
fill(60, 0, 255);
triangle(200, 104, 280, 280, 120, 280);
fill(255, 255, 255);
var answer = floor(random(1, 5));
if (answer === 2) {
    text("NOT YET", 176, 200);
}
else if( answer===3)
{
    text("IMPLEMENTED", 159, 229);   
}
else if(answer===4){
    text("Yes",185,229);
}
else if(answer===1){
    text("NO",185,229);
}
else if(answer===5){
    text("Try Again",185,200);
}
<script type="text/javascript">
// code in here
</script>

您甚至不再真正需要"type"属性了!