简体   繁体   English

为什么document.getElementsByClassname()杀死Tizen Web应用程序?

[英]Why does document.getElementsByClassname() kill tizen web app?

I have some html similar to this, using TAU: 我有一些类似的HTML,使用TAU:

<div class="ui-page" id="initialize-page">
    <div class="ui-header">
        <h2 class="ui-title">Page1</h2>
    </div>
    <div class="ui-content">
        <p>Content</p>
    </div>
    <div class="ui-footer ui-bottom-button">
        <button class="ui-btn startBtn" id="Test1Btn">Continue</button>
    </div>
</div>
<div class="ui-page" id="debug-page">
    <div class="ui-header">
        <h2 class="ui-title">Page2</h2>
    </div>
    <div class="ui-content">
        <article>
            <section class="contents" id="setup">
                <div>
                    <button class="ui-btn startBtn" id="start">Start</button>
                    <button class="ui-btn" id="pause">Pause</button>
                    <textarea disabled id="infobox"></textarea>
                </div>
            </section>
        </article>
    </div>
</div>

Now I try to select the two buttons with startBtn in their class attribute with JavaScript like this: 现在,我尝试使用JavaScript在class属性中选择带有startBtn的两个按钮,如下所示:

window.onload = function(){
    var startBtnList = document.getElementsByClassName('startBtn');
}

But everytime I start the debugging on the Gear S3 the Application hangs up at this line, as if it was an endless loop. 但是,每次我在Gear S3上启动调试时,应用程序都会挂在这行,就像是一个无休止的循环。 I cannot see why. 我不明白为什么。 Does someone have a clue? 有人有线索吗?

getElementsByClassName() returns array. getElementsByClassName()返回数组。 Use getElementsByClassName('startBtn')[0] and getElementsByClassName('startBtn')[1] seperately. 分别使用getElementsByClassName('startBtn')[0]和getElementsByClassName('startBtn')[1]。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM