Odd javascript error in IE 7 but not in IE 8
<p>I am using a 3rd party control in a website project in VS 2010 that runs upon the 3.5 framework (yes, I need to upgrade it to 4.0 but I'm lazy). The 3rd party control has various client side events that can be handled using javascript. For example, it has an OnClientDoubleClick event:</p>

<pre><code>&lt;myUserCtrl:SpecialView ID="ucSpecialView" runat="server" OnClientDoubleClick="myDoubleClick"&gt;
&lt;/myUserCtrl:SpecialView&gt;
</code></pre>

<p>and the accompanying javascript goes something like:</p>

<pre><code>&lt;script type="text/javascript" language="javascript"&gt;
  function myDoubleClick(sender, args) {
    // and we do whatever we need to in here
  }
&lt;/script&gt;
</code></pre>

<p>I am using masterpages and I have the javascript above located within the header content holder for the child page (basically I'm saying that I have the javascript in the right spot and I haven't just plopped it down somewhere in the middle of my page).</p>

<p><strong>My problem:</strong>
Using IE's Developer Tools (found in the menu bar or by hitting F12), if I attempt to view the webpage with the Browser Mode set to "Internet Explorer 7" then I get a javascript error.</p>

<p><em>Microsoft JScript runtime error: 'myDoubleClick' is undefined</em></p>

<p>However, if I view the webpage by setting the Browser Mode to "Internet Explorer 8" then I do not see the javascript error and the control functions as it should (including the javascript function myDoubleClick).</p>

<p>Is this a problem with my 3rd party control (do I need to contact my vendor and bug them)? Or is it a problem with my code? I've done a decent amount of googling and scouring my code and I can't seem to come up with anything. </p>

<p><strong>EDIT:</strong>
It appears that another developer has included some javascript functions that run in the masterpage. Said functions are within a script tag that is itself within a div tag for reasons of which I'm not certain (although the div tag has runat attribute set to "server" and so I suspect its because the script tags are pulling some client id's for one reason or another). In any case, this is highly unorthodox as the div tag surrounding the script tag is within the header tag (ie - div tags don't belong in the header tag). This does appear to be the culprit. I did some testing and found that if I placed myDoubleClick function in the script tag that resides in the masterpage then the javascript error doesn't occur on page load like it used to. However, this isn't a viable solution since my javascript function also pulls upon various client id's of controls of the child webpage and therefore must be located in the content place holder of the child webpage.</p>

<pre><code>&lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"&gt;
  &lt;script type="text/javascript" language="javascript"&gt;

    function myDoubleClick(sender, args) {
      if (confirm("Are you sure you want to delete this node?")) {
        $get("&lt;%= btnDeleteNode.ClientID %&gt;").click(); //full postback for delete node
      }
    }

  &lt;/script&gt;
&lt;/asp:Content&gt;
</code></pre>
