how to show popup on right click

Posted by Abhi_patil under JavaScript on 2/19/2009 | Views : 4596 | Status : [Member] | Replies : 2
i am doing spell ckeck.
i want to show popup when right click on any word.




Responses

Posted by: Shraddhapatel on: 4/5/2019 [Member] Starter | Points: 25

Up
0
Down
function popupBaseDetails(div,e) {
e.preventDefault()
div.querySelector(".basepopup").classList.toggle("show");
}

.show{
color:red;
}

<div id="drag-base" class="popup draggable" oncontextmenu="popupBaseDetails(this,event)">
<span class="basepopup">A Simple Popup!</span>
</div>

Dot Net Developer at iFour Technolab Pvt Ltd
www.ifourtechnolab.com

Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Majith on: 2/19/2009 [Member] Starter

Up
0
Down
Hi Abhi ,

Cal the JavaScript Method in 'OnContextMenu' for Right Click option.

<script type="text/javascript">

function HideModalPopup()
{
var test= $find('ModalPopupExtender1');
test.hide();
}
function showModalPopup()
{
window.parent.document.getElementById('ModalPopupExtender1').show();
}

</script>

<asp:ImageButton ID="ShowBtn" runat="server" />
<Ajax:ModalPopupExtender
ID="ModalPopupExtender1" runat="server" CancelControlID="imbOK"
OkControlID="imbOK" OnCancelScript="HideModalPopup()" PopupControlID="pnlPopup"
TargetControlID="pnlPopup">
</Ajax:ModalPopupExtender>

In PageLoad Event call the Javascript 'showModalPopup()' Method.


ShowBtn.attributes.Add("OnContextMenu","showModalPopup()");

Thats all.




Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response