国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - le clic de l'événement onclick ne fonctionne pas
迷茫
迷茫 2017-06-06 09:52:06
0
5
1175

1 Je ne sais pas pourquoi l'événement onclick ne fonctionne pas. . .
html
<p id="leftSide_xia" style="display:none;text-align:center;">

                    <ul class="" style="margin-top:10px;">
                    <!-- <li  style="height:52px;cursor:pointer;" onclick="openIllegalPage('isOnList')">wwwwwww</li>-->
                    <p onclick="openIllegalPage('websiteList')"><img name="leftSide_xia_menu"  onclick="openIllegalPage('websiteList')" src="/images/frame/icon_a.png" style="margin-left:35px;float:left;margin-top:6px;"/><li  onclick="openIllegalPage('websiteList')" style="height:30px;cursor:pointer;" ><a  onclick="openIllegalPage('websiteList')" style="margin-right:25%;">wwww覽</a> </li><hr  style="border:0;background-color:rgb(8,30,44);height:2px;margin-top:0px;width:90%;"/>
                       </p>
                    <p onclick="openIllegalPage('websiteNameList')"><img name="leftSide_xia_menu" src="/images/frame/icon_a.png" style="margin-left:35px;float:left;margin-top:6px;"/><li  style="height:30px;cursor:pointer;" ><a style="margin-right:25%;">wwwwwwww</a></li><hr  style="border:0;background-color:rgb(8,30,44);height:1px;margin-top:0px ;width:90%;"/>
                       </p>
                    <p>
                        <img name="leftSide_xia_menu" src="/images/frame/icon_a.png" style="margin-left:35px;float:left;margin-top:6px;"/><li  style="height:30px;cursor:pointer;" onclick="openIllegalPage('recordNumberList')"><a style="margin-right:28%;">wwwwwwww/a></li></li><hr  style="border:0;background-color:rgb(8,30,44);height:1px;margin-top:0px ;width:90%;"/>
                    </p>
                    <p><img name="leftSide_xia_menu" src="/images/frame/icon_a.png" style="margin-left:35px;float:left;margin-top:6px;"/><li  style="height:30px;cursor:pointer;" onclick="openIllegalPage('unitNameList')"><a style="margin-right:25%;">wwwwww</a></li><hr  style="border:0;background-color:rgb(8,30,44);height:1px;margin-top:0px ;width:90%;"/>
                       </p>
                    <p><img name="leftSide_xia_menu" src="/images/frame/icon_a.png" style="margin-left:35px;float:left;margin-top:6px;"/><li  style="height:30px;cursor:pointer;" onclick="openIllegalPage('contactNameList')"><a style="margin-right:28%;">wwwwwwww</a></li><hr  style="border:0;background-color:rgb(8,30,44);height:2px;margin-top:0px ;width:90%;"/>
                       </p>
                    <p><img name="leftSide_xia_menu" src="/images/frame/icon_a.png" style="margin-left:35px;float:left;margin-top:6px;"/><li  style="height:30px;cursor:pointer;" onclick="openIllegalPage('contactNameList')"><a style="margin-right:20%;">wwwwww</a></li><hr  style="border:0;background-color:rgb(8,30,44);height:1px;margin-top:0px ;width:90%;"/>
                       </p>
                    <p><img name="leftSide_xia_menu" src="/images/frame/icon_a.png" style="margin-left:35px;float:left;margin-top:6px;"/><li  style="height:30px;cursor:pointer;" onclick="openIllegalPage('contactTelephoneList')"><a style="margin-right:10%;">wwwwwww</a></li><hr  style="border:0;background-color:rgb(8,30,44);height:1px;margin-top:0px ;width:90%;"/>
                </p>
                    </ul> 
                </p>
                


迷茫
迷茫

業(yè)精于勤,荒于嬉;行成于思,毀于隨。

répondre à tous(5)
洪濤

<p onclick="openIllegalPage('websiteList')">

function openIllegalPage(ppp,pageName){
    if(pageName=="websiteList")
}

Faites attention aux paramètres

小葫蘆

S'il n'y a pas d'erreur dans l'opération, elle sera exécutée. Vous pouvez jeter un ?il à la méthode alert() de openIllegalPage. Je viens de copier votre code et j'ai vu qu'il peut exécuter cette fonction
Si vous écrivez plusieurs événements de clic, cela entrera en conflit. Par exemple, si vous cliquez sur un élément à l'intérieur, tous les éléments à l'extérieur seront exécutés.
Je l'ai optimisé, vous pouvez vous y référer :
html:
<ul class="" style="margin-top:10px;">

        <!-- <li  style="height:52px;cursor:pointer;" onclick="openIllegalPage('isOnList')">網(wǎng)站在線監(jiān)察</li>-->
        <p>
            <img name="leftSide_xia_menu" src="/images/frame/icon_a.png" style="margin-left:35px;float:left;margin-top:6px;" />
            <li style="height:30px;cursor:pointer;">
                <a style="margin-right:25%;">不規(guī)范網(wǎng)站總覽</a>
            </li>
            <hr style="border:0;background-color:rgb(8,30,44);height:2px;margin-top:0px;width:90%;" />
        </p>

</ul>

js:
window.onload = function() {

            var onUl = document.querySelector('ul');
            onUl.onclick = function(e) {
                /**
                 * e.target為事件源(也就是你點(diǎn)哪個(gè)就是哪個(gè))
                 * 這時(shí)候你點(diǎn)哪個(gè)就是拿到哪個(gè)的節(jié)點(diǎn)了,
                 * 然后根據(jù)(e.target.tagName)判斷
                 */
                console.log(e.target.tagName);
            }

        }
迷茫

Vous avez ajouté un événement de clic à p, puis vous avez également ajouté un événement de clic à l'img sous p. Cela entra?nera une duplication des paramètres, ou vous pouvez simplement l'ajouter à img. Vous ne voulez pas taper de code sur le mobile. téléphone.

洪濤

Le débogage des points d'arrêt n'est vraiment pas possible

世界只因有你

Le code ne supporte pas qu'on le regarde

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal