Avatar billede funkeychicken Nybegynder
08. august 2002 - 22:06 Der er 4 kommentarer og
1 løsning

haster....30 point for et lousy link :-)

fandt engagn sådan et script så man selv kan lave sin højrekliks menu..men kan ik huske den...kender i den...
Avatar billede runeevers Nybegynder
08. august 2002 - 22:09 #1
Avatar billede thesurfer Nybegynder
08. august 2002 - 22:11 #2
Avatar billede thesurfer Nybegynder
08. august 2002 - 22:12 #3
grund: den opføre sig mere som den "normale" context menu der dukker frem når man højreklikker..

den på dhtmlshock.com forsvinder ved onMouseOut..
Avatar billede thesurfer Nybegynder
08. august 2002 - 22:14 #4
prøv evt også at erstatte den sidste del ("contextmenu.htm") med "contextmenu2.htm"..

der er 2 scripts..

/theSurfer.
Avatar billede nikolajdu Nybegynder
08. august 2002 - 22:26 #5
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
    <TITLE>oncontextmenu Event Sample</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<META NAME="AUTHOR" CONTENT="InetSDK">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="noindex">

<STYLE>
.menuItem {font-family:sans-serif;font-size:10pt;width:100;padding-left:20;
  background-Color:menu;color:black}
.highlightItem {font-family:sans-serif;font-size:10pt;width:100;padding-left:20;
  background-Color:highlight;color:white}
.clickableSpan {padding:4;width:500;background-Color:blue;color:white;border:5px gray solid}
</STYLE>

<SCRIPT>
//<!--

function displayMenu() {
  whichDiv=event.srcElement;
  menu1.style.leftPos+=10;
  menu1.style.posLeft=event.clientX;
  menu1.style.posTop=event.clientY;
  menu1.style.display="";
  menu1.setCapture();
}
function switchMenu() { 
  el=event.srcElement;
  if (el.className=="menuItem") {
      el.className="highlightItem";
  } else if (el.className=="highlightItem") {
      el.className="menuItem";
  }
}
function clickMenu() {
  menu1.releaseCapture();
  menu1.style.display="none";
  el=event.srcElement;
  if (el.id=="mnuRed") {
      whichDiv.style.backgroundColor="red";
  } else if (el.id=="mnuGreen") {
      whichDiv.style.backgroundColor="green"; 
  } else if (el.id=="mnuBlue") {
      whichDiv.style.backgroundColor="blue"; 
  } else if (el.id=="mnuYellow") {
      whichDiv.style.backgroundColor="yellow"; 
  }
}

//-->
</SCRIPT>


<!-- SAMPLE_STYLE_START -->
<LINK REL="stylesheet" HREF="/workshop/basicSDKIE4.css" TYPE="text/css">
<!-- SAMPLE_STYLE_END -->
</HEAD>
<!-- TOOLBAR_START -->
<!-- TOOLBAR_EXEMPT -->
<!--TOOLBAR_END-->

<BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
LINK="#000000" VLINK="#808080" ALINK="#000000">
<BLOCKQUOTE CLASS="body">

<!-- CONTENTS_START -->
<H1>oncontextmenu Event Sample</H1>
<P>This sample shows how to use the <B>oncontextmenu</B> event handler, available in Microsoft&#174; Internet Explorer 5 and later, to display both standard and custom context menus and prevent context menus from displaying. Experiment with each of the following boxes to see how you can apply different methods either to display or to inhibit context menus. Each box provides instructions for you to follow.
</P>

<SPAN class="clickableSpan">
1. The default context menu always displays when you right-click in this box.
<b><br>Code: </b>
//no code necessary
</SPAN><br><br>

<SPAN class="clickableSpan" oncontextmenu="return event.ctrlKey">
2. The default context menu displays only if you right-click in this box while holding down the Ctrl key. This is useful for developing and debugging purposes.
<b><br>Code: </b>
oncontextmenu="return event.ctrlKey"
</SPAN><br><br>

<SPAN class="clickableSpan" oncontextmenu="return false">
3. A context menu never displays when you right-click in this box.
<b><br>Code: </b>
oncontextmenu="return false"
</SPAN><br><br>

<SPAN class="clickableSpan" oncontextmenu="displayMenu();return false">
4. A custom context menu displays when you right-click in this box.
<b><br>Code: </b>
oncontextmenu="showMenu();return false;"
</SPAN><br><br>

<SPAN class="clickableSpan" oncontextmenu="if (!event.ctrlKey){displayMenu();return false;}">
5. A custom menu displays when you right-click in this box.  If you right-click while holding down the Ctrl key, the default context menu displays.
<b><br>Code: </b>
oncontextmenu="if (!event.ctrlKey){displayMenu();return false;}"
</SPAN><br>

<div id=menu1 onclick="clickMenu()" onmouseover="switchMenu()" onmouseout="switchMenu()" style="position:absolute;display:none;width:100;background-Color:menu; border: outset 3px gray">
<div class="menuItem" id=mnuRed>Red</div>
<div class="menuItem" id=mnuGreen>Green</div>
<div class="menuItem" id=mnuBlue>Blue</div>
<div class="menuItem" id=mnuYellow>Yellow</div>
</div>


<!-- CONTENTS_END -->
<!-- START_PAGE_FOOTER -->
<BR><BR><BR>
&copy; <A CLASS="clsIncCpyRt" HREF="http://www.microsoft.com/isapi/gomscom.asp?TARGET=/info/cpyright.htm" TARGET="_top"> 2002 Microsoft Corporation. All rights reserved. Terms of use</A>.
<!-- END_PAGE_FOOTER -->
</BLOCKQUOTE>
</BODY>
</HTML>

/Nikolaj
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester