title: javascript click() function doesn't work in safari
body: <p>The next code works fine in all the browsers, except Safari. Why? </p>
  
  <pre><code>&lt;body onload="document.getElementById('click').click();"&gt;
  &lt;a id="click" class="fancybox" href="#select"&gt;click&lt;/a&gt;
  &lt;div id="select"&gt;Welcome!&lt;/div&gt;
  </code></pre>
  
  <p>This code implies jquery. Maybe this is the problem ? Why it doesn't work in Safari ?</p>
  
  <p>The next variant also doesn't work:</p>
  
  <pre><code>&lt;a id="click" class="fancybox" href="#select" onmouseover="this.click();"&gt;
  </code></pre>
  
  <p>unless I click with the mouse (not on mouse over, as it should). So the problem is with click() function (just in Safari). What can I do ?</p>
  
  <p><strong>SOLVED:</strong></p>
  
  <p>Just must be added this function:</p>
  
  <pre><code>&lt;script&gt;
  function autoclick(id) {
  var a = $(id)[0];
  var evObj = document.createEvent('MouseEvents');
  evObj.initMouseEvent('click', true, true, window);
  a.dispatchEvent(evObj); }
  &lt;/script&gt;
  </code></pre>
  
  <p>And then, it can be called like this:</p>
  
  <pre><code>&lt;body onload="autoclick('#click')"&gt;
  &lt;a id="click" class="fancybox" href="#select"&gt;click&lt;/a&gt;
  &lt;div id="select"&gt;Welcome!&lt;/div&gt;
  </code></pre>
  
  <p>or, another example:</p>
  
  <pre><code>&lt;a id="click" class="fancybox" href="#select" onmouseover="autoclick('#click')"&gt;
  </code></pre>
  
  <p>Thanks to everyone!</p>