精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦>學(xué)習(xí)電腦>電腦硬件知識(shí)>鍵盤鼠標(biāo)>

      js怎么切換鼠標(biāo)右鍵事件

      時(shí)間: 沈迪豪908 分享

        學(xué)習(xí)前端的同學(xué)你們知道js怎么切換鼠標(biāo)右鍵事件嗎?不知道的話跟著學(xué)習(xí)啦小編一起來學(xué)習(xí)了解切換鼠標(biāo)右鍵事件的方法吧。

        js 切換鼠標(biāo)右鍵事件的方法

        <%--

        /**

        *實(shí)現(xiàn)右鍵菜單功能

        */

        --%>

        <html>

        <body oncontextmenu = showMenu('')>

        <form name = "menuForm">

        <!--隱藏框,用來保存選擇的菜單的id值-->

        <input type = "hidden" name = "id" value = "">

        <table>

        <tr><td><a href="javascript:clickMenu()" oncontextmenu = showMenu('0')>根目錄</a></td></tr>

        <tr><td><a href="javascript:clickMenu()" oncontextmenu = showMenu('1')>菜單一</a></td></tr>

        <tr><td><a href="javascript:clickMenu()" oncontextmenu = showMenu('2')>菜單二</a></td></tr>

        </table>

        </form>

        </body>

        <!-- 這里用來定義需要顯示的右鍵菜單 -->

        <div id="itemMenu" style="display:none">

        <table border="1" width="100%" height="100%" bgcolor="#cccccc" style="border:thin" cellspacing="0">

        <tr>

        <td style="cursor:default;border:outset 1;" align="center" onclick="parent.create()">

        新增

        </td>

        </tr>

        <tr>

        <td style="cursor:default;border:outset 1;" align="center" onclick="parent.update();">

        修改

        </td>

        </tr>

        <tr>

        <td style="cursor:default;border:outset 1;" align="center" onclick="parent.del()">

        刪除

        </td>

        </tr>

        </table>

        </div>

        <!-- 右鍵菜單結(jié)束-->

        </html>

        <script language="JavaScript">

        /**

        *根據(jù)傳入的id顯示右鍵菜單

        */

        function showMenu(id)

        {

        menuForm.id.value = id;

        if("" == id)

        {

        popMenu(itemMenu,100,"100");

        }

        else

        {

        popMenu(itemMenu,100,"111");

        }

        event.returnValue=false;

        event.cancelBubble=true;

        return false;

        }

        /**

        *顯示彈出菜單

        *menuDiv:右鍵菜單的內(nèi)容

        *width:行顯示的寬度

        *rowControlString:行控制字符串,0表示不顯示,1表示顯示,如“101”,則表示第1、3行顯示,第2行不顯示

        */

        function popMenu(menuDiv,width,rowControlString)

        {

        //創(chuàng)建彈出菜單

        var pop=window.createPopup();

        //設(shè)置彈出菜單的內(nèi)容

        pop.document.body.innerHTML=menuDiv.innerHTML;

        var rowObjs=pop.document.body.all[0].rows;

        //獲得彈出菜單的行數(shù)

        var rowCount=rowObjs.length;

        //循環(huán)設(shè)置每行的屬性

        for(var i=0;i<rowObjs.length;i++)

        {

        //如果設(shè)置該行不顯示,則行數(shù)減一

        var hide=rowControlString.charAt(i)!='1';

        if(hide){

        rowCount--;

        }

        //設(shè)置是否顯示該行

        rowObjs[i].style.display=(hide)?"none":"";

        //設(shè)置鼠標(biāo)滑入該行時(shí)的效果

        rowObjs[i].cells[0].onmouseover=function()

        {

        this.style.background="#818181";

        this.style.color="white";

        }

        //設(shè)置鼠標(biāo)滑出該行時(shí)的效果

        rowObjs[i].cells[0].onmouseout=function(){

        this.style.background="#cccccc";

        this.style.color="black";

        }

        }

        //屏蔽菜單的菜單

        pop.document.oncontextmenu=function()

        {

        return false;

        }

        //選擇右鍵菜單的一項(xiàng)后,菜單隱藏

        pop.document.onclick=function()

        {

        pop.hide();

        }

        //顯示菜單

        pop.show(event.clientX-1,event.clientY,width,rowCount*25,document.body);

        return true;

        }

        function create()

        {

        alert("create" + menuForm.id.value + "!");

        }

        function update()

        {

        alert("update" + menuForm.id.value + "!");

        }

        function del()

        {

        alert("delete" + menuForm.id.value + "!");

        }

        function clickMenu()

        {

        alert("you click a menu!");

        }

        </script>

      js 切換鼠標(biāo)右鍵事件的方法相關(guān)文章:

      1.js鼠標(biāo)右鍵菜單設(shè)置方法

      2.怎么用JS實(shí)現(xiàn)鼠標(biāo)單擊與雙擊事件共存

      3.jquery設(shè)置鼠標(biāo)右鍵方法

      4.怎么使用jquery實(shí)現(xiàn)鼠標(biāo)停止移動(dòng)事件

      5.w8鼠標(biāo)右鍵菜單設(shè)置方法

      6.設(shè)置鼠標(biāo)右鍵菜單方法

      js怎么切換鼠標(biāo)右鍵事件

      學(xué)習(xí)前端的同學(xué)你們知道js怎么切換鼠標(biāo)右鍵事件嗎?不知道的話跟著學(xué)習(xí)啦小編一起來學(xué)習(xí)了解切換鼠標(biāo)右鍵事件的方法吧。 js 切換鼠標(biāo)右鍵事件的方法 %-- /** *實(shí)現(xiàn)右鍵菜單功能 */ --% html body oncontextmenu = showMenu() form name =
      推薦度:
      點(diǎn)擊下載文檔文檔為doc格式

      精選文章

      • 什么是qt鼠標(biāo)事件
        什么是qt鼠標(biāo)事件

        大家了解qt鼠標(biāo)事件嗎?不知道的話跟著學(xué)習(xí)啦小編一起來學(xué)習(xí)了解qt鼠標(biāo)事件吧。 qt鼠標(biāo)事件大全 1、QMouseEvent中的坐標(biāo) QMouseEvent中保存了兩個(gè)坐標(biāo),一個(gè)是

      • lol補(bǔ)刀按鍵設(shè)置方法
        lol補(bǔ)刀按鍵設(shè)置方法

        愛玩游戲的小伙伴們,可能都玩過LOL,但是你知道lol補(bǔ)刀按鍵設(shè)置方法嗎?不知道的話跟著學(xué)習(xí)啦小編一起來學(xué)習(xí)了解lol補(bǔ)刀按鍵設(shè)置方法。 lol補(bǔ)刀按鍵怎

      • js鼠標(biāo)事件有哪些
        js鼠標(biāo)事件有哪些

        學(xué)習(xí)前端的同學(xué)你們知道怎么js鼠標(biāo)事件有多少個(gè)嗎?不知道的話跟著學(xué)習(xí)啦小編一起來學(xué)習(xí)了解js鼠標(biāo)事件。 js鼠標(biāo)事件大全 onClick IE3|N2|O3 鼠標(biāo)點(diǎn)擊事件,

      • flex鼠標(biāo)雙擊事件怎么實(shí)現(xiàn)
        flex鼠標(biāo)雙擊事件怎么實(shí)現(xiàn)

        學(xué)習(xí)前端的同學(xué)你們知道怎么你們知道什么是flex 鼠標(biāo)雙擊事件嗎?不知道的話跟著學(xué)習(xí)啦小編一起來學(xué)習(xí)了解flex 鼠標(biāo)雙擊事件。 flex 鼠標(biāo)雙擊事件的代碼

      2006847