国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

如何在asp.net頁面上放置的控件上實現左右鍵菜單,同時對之操作(2)

2024-07-10 12:57:53
字體:
來源:轉載
供稿:網友
上文說到菜單被創建出來了,現在要說的是第二部分的:

(2),選擇菜單,點擊菜單

選擇菜單和點擊菜單實際上時鼠標的mousemove和click事件。在上文提到的menustyle里面,我是通過javascript提供的window.createpopup函數來實現彈出菜單,彈出菜單的內容為一個表格。在表格中的每一項都提供了mousemove和click事件。

在mousemove事件發生的時候,我就讓他顯示出不同的風格。

當發生click事件的時候,就調用函數fnclick,使之發生我們的需要的任務。現在具體來介紹menustyle()函數。

function menustyle(){

if(window.navigator.appname == "microsoft internet explorer" && window.navigator.appversion.substring(window.navigator.appversion.indexof("msie") + 5, window.navigator.appversion.indexof("msie") + 8) >= 5.5)

isie = 1;

else

isie = 0;

if(isie){

menucontent = '<table id="rightmenu" width="0" height="0" cellspacing="0" cellpadding="0" style="font:menu;color:menutext;"><tr height="1"><td style="background:black" colspan="4"></td></tr><tr height="10"><td style="background:black"></td><td style="background:snow"><table cellspacing="0" cellpadding="0" nowrap style="font:menu;color:menutext;cursor:default;">'; //這一行是畫了個表格,從下面開始,添加表格里面的項目,同時給出了mouseover的風格等。最關鍵的一個地方是onclick事件發生調用的函數為parent.fnclickmenu,特別提醒的是調用的是父窗口的函數。

for(m=0;m<menuitems.length;m++){

if(menuitems[m][0] && menuitems[m][2])

menucontent += '<tr height="17" onmouseover="this.style.background=/'#9999cc/';this.style.color=/'menutext/';" onmouseout="this.style.background=/'snow/';this.style.color=/'menutext/';" onclick="parent.fnclickmenu(/''+menuitems[m][1]+'/')"<td style="background:threedface" width="1" nowrap></td><td width="21" nowrap><img src="' + menuitems[m][2] + '"></td><td nowrap>' + menuitems[m][0] + '</td><td width="21" nowrap></td><td style="background:threedface" width="1" nowrap></td></tr>';

else if(menuitems[m][0])

menucontent += '<tr height="17" onmouseover="this.style.background=/'#9999cc/';this.style.color=/'menutext/';" onmouseout="this.style.background=/'snow/';this.style.color=/'menutext/';" onclick="parent.fnclickmenu(/''+menuitems[m][1]+'/')"><td style="background:threedface" width="1" nowrap></td><td width="21" nowrap></td><td nowrap>' + menuitems[m][0] + '</td><td width="21" nowrap></td><td style="background:threedface" width="1" nowrap></td></tr>';

else

menucontent += '<tr><td colspan="5" height="4"></td></tr><tr><td colspan="5"><table cellspacing="0"><tr><td width="2" height="1"></td><td width="0" height="1" style="background:threedshadow"></td><td width="2" height="1"></td></tr><tr><td width="2" height="1"></td><td width="100%" height="1" style="background:threedhighlight"></td><td width="2" height="1"></td></tr></table></td></tr><tr><td colspan="5" height="3"></td></tr>';

}

menucontent += '</table></td><td style="background:threedshadow"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threedlightshadow"></td><td style="background:threedhighlight"></td><td style="background:threedface"></td><td style="background:threedshadow"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threedlightshadow"></td><td style="background:threedshadow" colspan="3"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threeddarkshadow" colspan="5"></td></tr></table>';

//下面就彈出了一個菜單。

menupopup = window.createpopup();

//菜單里面的東西為上面畫出的表格。

menupopup.document.body.innerhtml = menucontent;



結合上文的showmenu(),函數,就明白了如何實現彈出菜單功能的方法了。在fnclickmenu函數中。你就可以輕松的加上你想處理的各種功能了。

各位看官,如果不明
vvvvvvvvvvv
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 津南区| 宝山区| 专栏| 闵行区| 景洪市| 凤城市| 桃园市| 浑源县| 敦化市| 金川县| 通海县| 新田县| 栾城县| 吐鲁番市| 白山市| 古丈县| 哈密市| 巫山县| 喀什市| 莱阳市| 丹棱县| 曲麻莱县| 二连浩特市| 峨山| 南华县| 宜黄县| 黎川县| 前郭尔| 克拉玛依市| 永年县| 康乐县| 连州市| 青海省| 恩平市| 大埔区| 盱眙县| 嘉兴市| 定陶县| 中牟县| 武川县| 邻水|