单击javascript中的div [英] click on div in javascript

查看:50
本文介绍了单击javascript中的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii
val.click(),这里val是div id,它在ie和firefox中是完美的,但在chrome中不起作用,因此任何主体都可以使用此

感谢

hii
val.click(), here val is div id, it is perfectly works in ie and firefox but it is not working in chrome so any body have any alternative of this

thanks

推荐答案

您可能做错了.此代码示例也适用于Google Chrome:
You probably did it wrong. This code sample works with Google Chrome, too:
<html>
<head>
        <title>Will the click work with Google Chrome?</title>
</head>
<body>

    <div onclick="alert('working with Google Chrome!');">Test Google Crome: click here</div>

</body>
</html>

如果要查找问题所在,请制作一个(最小!)代码示例以证明此问题.当您说valid时,它将无法在任何地方使用,因为它应该是document.getElementById找到的对象,而不是id本身.

If you want to find where is your problem, make a (minimal!) code sample which manifests this problem. When you say val is id, it would not work anywhere, because it should be an object found by document.getElementById, not id itself.


这篇关于单击javascript中的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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