English 中文(简体)
我为什么要受到7-8年伊埃的一组子的点击?
原标题:Why can t I bind to a click event from a css class in IE 7-8?

为什么在互联网探索者7-8中将 Java印成本? 我试图做到的是,通过利用“Qu”来按班名称选择DIVs,把多个DIVs的点击事件连在一起。

该公司在Petherine、Khate Sato。 在电离层电离层电离层电离层电离层电离层中,电离层电离层电离层电离层电离层电离层电离层电离层电离层的电离层电离层电离层,电离层电离层电离层电离层电离层电离层。 无法在IEC 7或8工作。

<!DOCTYPE html>
<head>
    <title>IE Click Target Test</title>
</head>
<body>

    <div class="ClickTarget">Button 1</div>
    <div class="ClickTarget">Button 2</div>

    <!-- load jQuery 1.6.4 from CDN -->
    <script type="application/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>

    <script type="application/javascript">
        // This works fine in all browsers except IE pre-9. 
        $(document).ready(function () {

          $(".ClickTarget").click(function () {
              alert("If you can see me, it worked!");
          });

        });
    </script>
</body>
</html>
  • Normal disclaimers: I wouldn t HAVE to use jQuery for this example, but it illustrates a problem I am having with a larger solution that does use jQuery 1.6.4. IE is often quirky, I ve had to deal with it many years, but that s life.

出于某种原因,或许是即将到来的假日,我对一些事情视而不见。 有什么想法,为什么我无法在IE中登记点击?

最佳回答

我认为,在<代码><script>tags -

"text/javascript" is the only type that is supported by all three browsers. However, you don t actually need to put a type. The type attribute of a script tag will default to "text/javascript" if it is not otherwise specified. How that will affect validation, I m not sure. But does that really matter anyway?

https://stackoverflow.com/questions/1288263/why-doesnt-ie8-recognize-type-application-javascript-in-a-script-tag> 为什么IE8在文字标签中承认“应用/javascript”的类型?

问题回答

更改<代码> 字母 标签类型归于text/javascript,它应当对所有浏览器进行罚款。

正如Shankar最初所说的那样,它描述的文字类型不是“文字/文字”。

我在IE8中尝试了这一联合调查,并对我进行了罚款。

http://jsfiddle.net/Nna2T/"rel=“nofollow> http://jsfiddle.net/Nna2T/

这不是一个答案,而是评论可以制定格式守则,因此,只是一个月。

这是:

$(document).ready(function () { 
    ...
});

仅够:

$(function() { 
    ...
});




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签