为什么我不能点击课堂上的任何元素? [英] Why can't I click on any element in the class ?

查看:57
本文介绍了为什么我不能点击课堂上的任何元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<!doctype html>
<html>
<head>
<title></title>
<style>
.cards
{
background-color: blue;
height: 100px;
width: 75px;
margin: 20px;
float: left;
border: 2px solid orange;
border-radius: 7px;
}
</style>
</head>
<body>
<div class="cards"id="ace1"spades></div>
<div class="cards"id="king1"spades></div>
<div class="cards"id="queen1"spades></div>
<div class="cards"id="jack1"spades></div>
<div class="cards"id="ten1"spades></div>
<div class="cards"id="nine1"spades></div>
<div class="cards"id="ace2"hearts></div>
<div class="cards"id="king2"hearts></div>
<div class="cards"id="queen2"heart></div>
<div class="cards"id="jack2"heart></div>
<div class="cards"id="ten2"hearts></div>
<div class="cards"id="nine2"hearts></div>
<script type="text/javascript">
var cards = document.querySelector(".cards");
cards.addEventListener("click", card, false);
 function card()
 {
 console.log("hello world");
 }
</script>
</body>
</html>

推荐答案

你的意思是你不能点击一些HTML元素,在一个HTML元素上呈现页面,具有某些 class 属性?是的,这不是真的。相信我,你可以点击 绝对任何元素!此外,您可以单击计算机屏幕上的任何一点。但是你不应该期望在你做的时候会发生一些特别的事情,这实际上取决于你点击的内容。 :-)



(顺便说一句,请关注richcb对问题的评论。)



-SA
Do you mean that you cannot click at some HTML element, rendered on a page, which has certain "class" attribute? Is so, this is not true. Trust me, you can click on absolutely any element! moreover, you can click on any point of your computer screen. But you should not expect that something special happens when you do, it really depends on what you click on. :-)

(And, by the way, please pay attention for the comment to the question by richcb.)

—SA


这篇关于为什么我不能点击课堂上的任何元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆