开发者

Wizard like dialog using midori tab not working in chrome

i am trying to build a wizard like web dialog with the midori javascript framework.

Here is what i have:

<div id="uploadTab">
    <div id="categories" class="tab-set">
       <ul>
          <li class="tab-selected"><a id="tabConfig" href="#config">Configuration</a></li>
          <li><a id="tabDescription" href="#description">Description</a></li>

       </ul>
    </div>
    <div class="tab-content">
       <div id="config">
               <p>Hit Continue to go to next tab</p>
               <div class="tabButton">
                       <input type="button" name="configNext" value="Continue" onclick="retu开发者_运维百科rn selectTab('#tabDescription');" />
               </div>
       </div>
       <div id="description" style="display: none">
               Description
       </div>
    </div>
</div>
<script type="text/javascript">midori.addEventListener(window, 'ready', function (e) { midoriTab.init() } );</script>

And the javascript function which calls click() on the target tab's link

function selectTab(tabID) {
    var t=midori.get(tabID);
    if (typeof t!='undefined') {
            t.click();
    }
    return false;
}

This works find in firefox and opera, but in chrome i get:

Uncaught TypError: Object: http://mysite.com#description has no method 'click'

I also tried using onclick() instead of click(), which gives me:

Uncaught TypeError: Property 'onclick' of object http://mysite.com#description is not a function

Any way i can get this to work in chrome?


Problem solved:

A better way to send onclick event, that works on opera, firefox and chrome:

function selectTab(tabID) {
    var t=midori.get(tabID);
    if (typeof t!='undefined') {
            var e = document.createEvent('MouseEvents');
            e.initMouseEvent( 'click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null );
            t.dispatchEvent(e);
    }
    return false;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜