|
 |
|
อยากได้ Code Javascript ที่สามารถคลิ๊กขวา แล้วมีกรอบขึ้นมาให้ แล้วสามารถคลิ๊กไปที่อื่นๆได้น่ะค่ะ |
|
 |
|
|
 |
 |
|
ขอบคุณมากค่ะ แต่อยากได้แบบว่า Right Click ได้เฉพาะที่เป็น Link น่ะค่ะ แล้วมีเมนูย่อยออกมา และสามารถดึงค่า ID ของ Link อันนั้นมาด้วย
ไม่ทราบว่า Javascript สามารถทำได้มั๊ยค๊ะ
ขอบคุณมากค่ะ
|
 |
 |
 |
 |
Date :
17 ก.พ. 2549 10:17:45 |
By :
อ้น |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อาจจะได้ไม่ตรงตามต้องการ แต่ก็ลองดูนะครับ 
นำ CODE ด้านล่างไปไว้ที่ <head> ครับ
<STYLE>.skin0 {
BORDER-RIGHT: black 3px solid; BORDER-TOP: black 3px solid; VISIBILITY: hidden; BORDER-LEFT: black 3px solid; WIDTH: 300px; CURSOR: default; LINE-HEIGHT: 40px; BORDER-BOTTOM: black 3px solid; FONT-FAMILY: ms sans serif; POSITION: absolute; BACKGROUND-COLOR: menu; TEXT-ALIGN: left
}
.skin1 {
BORDER-RIGHT: buttonhighlight 3px outset; BORDER-TOP: buttonhighlight 3px outset; FONT-SIZE: 11pt; VISIBILITY: hidden; BORDER-LEFT: buttonhighlight 3px outset; WIDTH: 210px; CURSOR: default; BORDER-BOTTOM: buttonhighlight 3px outset; FONT-FAMILY: ms sans serif; POSITION: absolute; BACKGROUND-COLOR: menu; TEXT-ALIGN: left
}
.menuitems {
PADDING-RIGHT: 5px; PADDING-LEFT: 5px
}
</STYLE>
<SCRIPT language=JavaScript1.2>
<!-- Begin
var menuskin = "skin1"; // skin0, or skin1
var display_url = 0; // Show URLs in status bar?
function showmenuie5() {
var rightedge = document.body.clientWidth-event.clientX;
var bottomedge = document.body.clientHeight-event.clientY;
if (rightedge < ie5menu.offsetWidth)
ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth;
else
ie5menu.style.left = document.body.scrollLeft + event.clientX;
if (bottomedge < ie5menu.offsetHeight)
ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
else
ie5menu.style.top = document.body.scrollTop + event.clientY;
ie5menu.style.visibility = "visible";
return false;
}
function hidemenuie5() {
ie5menu.style.visibility = "hidden";
}
function highlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "highlight";
event.srcElement.style.color = "white";
if (display_url)
window.status = event.srcElement.url;
}
}
function lowlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "";
event.srcElement.style.color = "black";
window.status = "";
}
}
function jumptoie5() {
if (event.srcElement.className == "menuitems") {
if (event.srcElement.getAttribute("target") != null)
window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
else
window.location = event.srcElement.url;
}
}
// End -->
</SCRIPT>
นำ CODE ด้านล่างไปไว้ที่ <body> ครับ
<DIV class=skin0 id=ie5menu onmouseover=highlightie5() onclick=jumptoie5(); onmouseout=lowlightie5()>
<DIV class=menuitems url="http://www.codetukyang.cjb.net/">กลับไปหน้าหลัก</DIV>
<DIV class=menuitems url="http://www.geocities.com/namkiatv/html">ไปหน้าภาษา HTML</DIV>
<HR>
<DIV class=menuitems url="http://www.geocities.com/namkiatv/java">ไปหน้าภาษา JAVASCRIPT หน้า 1</DIV>
<DIV class=menuitems url="http://www.geocities.com/namkiatv/codeactionreplay">ไปหน้า CODE ACTION REPLAY</DIV>
<HR>
<DIV class=menuitems url="http://www.hotmail.com/">ไปที่ HOTMAIL.COM</DIV>
<DIV class=menuitems url="http://www.yahoo.com/">ไปที่ YAHOO.COM</DIV></DIV>
<SCRIPT language=JavaScript1.2>
if (document.all && window.print) {
ie5menu.className = menuskin;
document.oncontextmenu = showmenuie5;
document.body.onclick = hidemenuie5;
}
</SCRIPT>
|
 |
 |
 |
 |
Date :
17 ก.พ. 2549 15:30:16 |
By :
เพื่อน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากค่ะ ที่ช่วยตอบค่ะ พอดีหาได้แล้วค่ะ ตามที่ต้องการเป๊ะเลยค่ะ
ตัวอย่าง Code นะคี เผื่อเป็นประโยชน์กับคนอื่นๆค่ะ
<html>
<head>
<title>Untitled</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
function showMenuLayer1() {
document.getElementById("MenuLayer1").style.height="150px";
document.getElementById("MenuLayer1").style.clip="rect(0,150,150,0)";
document.getElementById("MenuLayer1").style.left = event.clientX;
document.getElementById("MenuLayer1").style.top = event.clientY;
}
function hideMenuLayer1() {
document.getElementById("MenuLayer1").style.height="0px";
document.getElementById("MenuLayer1").style.clip="rect(0,0,0,0)";}
</script>
<body>
<div id="MenuLayer1" STYLE="visibility:visible;background-color:#004EC3;position:absolute;width:150px;height:0px;overflow:hidden;clip:rect(0,0,0,0);">
<table border="1">
<tr>
<td>
<CENTER>About Me<BR>
<a href="#">About My Interets</a><BR>
About My Website<BR><BR>
<input type=button value="Close" onClick="hideMenuLayer1();"></CENTER>
</td>
</tr>
</table>
</div>
<A HREF="#" onContextMenu="showMenuLayer1(); return false;">About</A>
</body>
</html>

|
 |
 |
 |
 |
Date :
20 ก.พ. 2549 13:39:14 |
By :
อ้น |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณคับที่มี code แล้วมาแบ่งปันกันดู
บางคนบอกหาที่อื่นได้แล้วก็แล้วกันเลย
ผมคิดว่า ก่อนที่จะเป็นผู้รับควรจะหัดเป็นผู้ให้มาก่อนบ้าง
|
 |
 |
 |
 |
Date :
20 ก.พ. 2549 18:17:09 |
By :
nut_t02 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|