自定義右鍵選單

2021-10-01 05:57:47 字數 1139 閱讀 1067

禁止系統右鍵選單

document.oncontextmenu=function();

獲取滑鼠藍色框選中的內容

document.getselection().tostring(); //火狐不能得到文字框內的內容

**示例:

"utf-8"

>

<

/title>

*

ulli

li:hover

<

/style>

<

/head>

aaaa

"" rows=

"40" cols=

"40"

>

<

/textarea>

重新整理<

/li>

離開頁面<

/li>

/li>

輸入搜素<

/li>

<

/ul>

var ul=document.

queryselector

("ul");

var textarea=document.

queryselector

("textarea");

//禁止系統右鍵選單

document.

oncontextmenu

=function

(event)

//當滑鼠右鍵按下顯示自定義選單

document.

onmousedown

=function

(event)

else

}//採用事件委託機制

ul.onmousedown

=function

(event)

if(event.target.innerhtml==

"離開頁面")}

if(event.target.innerhtml==)if

(event.target.innerhtml==

"輸入搜素")}

<

/script>

<

/body>

<

/html>

自定義Flex右鍵選單

1.右鍵專案設定flex編譯器的引數如下 其實flash player從11.版本就支援自定義右鍵選單了。2.重新編譯flex專案或關閉專案後重新開啟,錯誤解除。3.測試 如下 xmlns s library xmlns mx library minwidth 955 minheight 600 i...

windows 自定義右鍵選單

引用 1.組合鍵win r,輸入regedit,回車 開啟登錄檔編輯器 2.找到目錄中 hkey classes root directory background shell 對其右鍵,新建乙個項 新建資料夾 並命名為 stikynot 你也可以將此資料夾命名為 開啟便箋 這個資料夾的名稱就是新建...

Qt之自定義選單(右鍵選單)

在接觸qt這段時間以來,經常遇到選單項的問題 右鍵選單 托盤選單 按鈕選單等 qmenu用於選單欄,上下文選單,彈出選單等,利用qmenu qaction就可以達到效果!右鍵選單實現 通過重寫contextmenuevent qcontextmenuevent event 事件,qmenu qact...