473,761 Members | 9,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

right and left click

hi all,
i have this problem.i want the user of my page to only click the link
with the right mouse button and open a word document using the open in
new window option.if he clicks on the left button i should prompt an
alert message till he clicks the right mouse button
..i just want to write only a FEW lines of code.the code needs to
written inside the <a href></a> tags.can any one help me.

waiting for ur solutions.thank ing u in advance.
Jul 20 '05 #1
4 2107
In article <f3************ **************@ posting.google. com>, craynet13
@yahoo.com enlightened us with...
hi all,
i have this problem.i want the user of my page to only click the link
with the right mouse button and open a word document using the open in
new window option.if he clicks on the left button i should prompt an
alert message till he clicks the right mouse button
.i just want to write only a FEW lines of code.the code needs to
written inside the <a href></a> tags.can any one help me.

Why would you want to do such a thing?
This is contrary to all web standards.

If you REALLY feel the need to have it open in a new window, then set
the target.
<a href="whatever. doc" target="_blank" >doc</a>

Not that that follows web standards, either.

--
--
~kaeli~
A plateau is a high form of flattery.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2
Lakshmi Narayanan wrote on 18 feb 2004 in comp.lang.javas cript:
i have this problem.i want the user of my page to only click the link
with the right mouse button and open a word document using the open in
new window option.if he clicks on the left button i should prompt an
alert message till he clicks the right mouse button
.i just want to write only a FEW lines of code.the code needs to
written inside the <a href></a> tags.can any one help me.


A bit silly thing to do, I hope never to visit such page!

IE6 tested:

<a href="http://www.cnn.com/"
onclick="alert( 'Use other mouse button please for: '+
this.href);retu rn false;"
oncontextmenu=" location.href=t his.href;return false;">
Click me right here</a>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #3
hi thanx Evertjan
the code works well to my problem.you have given me the solution that i
had been searching for.thanx once again.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4
kaeli wrote:
@yahoo.com enlightened us with...
[...] i want the user of my page to only click the link with the
right mouse button and open a word document using the open in new
window option.if he clicks on the left button i should prompt an
alert message till he clicks the right mouse button .[...]
Why would you want to do such a thing? This is contrary to all web
standards.


More, it is contrary to usability standards for Graphical User
Interfaces (GUIs). The "right", i.e. the secondary (if not
configured left-handed), mouse button, is (if present) usually
reserved for the context-sensitive menu in GUIs. For example
Opera is an exception, because it allows one (the secondary by
default) mouse button as dragger button for mouse gestures.
If you REALLY feel the need to have it open in a new window, then set
the target. <a href="whatever. doc" target="_blank" >doc</a>

Not that that follows web standards, either.


target="_blank" is valid HTML 4.01 Transitional and valid XHTML 1.0
Transitional. I fail to see a violation of standards here, if I am
understanding you correctly. It is not recommended, though, since
it "breaks" the Back functionality in windowed UAs.
PointedEars
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2035
by: George Hester | last post by:
In a page I have when the user left-clicks the page a Input box for a form gets the focus. But if the user right-clicks the page the Input box is not getting the focus. I'd like the Input box to get the focus no matter where on the page the user clicks be it right-click or left-click. Right now there is no context menu when the user right-clicks. Do you think that's the problem? Any ideas how to get this right-click left-click Input box...
2
506
by: cmelnick | last post by:
I need to determine whether the user used the right or left mouse button to click an element on a form. AFAIK, there is no way to determine this from the Click (or DoubleClick) event. I currently have my form set up to have a MouseButtons instance that gets updated by the MouseDown event, then the Click event checks the instance to see if it was right or left. This works fine, but seems a very roundabout and clumsy way to do something...
4
1971
by: John Bailo | last post by:
Is there any way to enable right click on a winform button?
3
3608
by: mitsura | last post by:
Hi, I have included a small listing. The test program opens a panel and show a bitmap. What I want is to when the mouse is over the bitmap panel, I want to trap the left mouse click. The purpose is to get the position of the mouse pointer on the bitmap. However, for some reason, the left (I also tried right) mouse clicks are not intercepted. I new to Python and wxWindows so any help would be greatly appreciated.
4
7178
by: humble.apprentice | last post by:
Hi everybody, I've got a TreeView and when ever I right-click on it, the ContextMenuStrip should comes up. The problem is the following, if the user didn't left-click an then right click the node he or she desired, the ContextMenuStrip will show the options for the node that was left-clicked before. How can I make it work like explorer does that it doesn't need to be left-clicked and then right -clicked? I will appreciate if you can...
13
2308
by: James Bond | last post by:
Hello. My 80+ year old father has recently decided to get his first computer. Due to his age (and I suspect lack of playing pong as a child like I did) he lacks the manual dexterity to use a mouse well. He is frequently missing the left mouse button and hitting the right, or less often the middle (wheel) buttons. While he is very slowly getting better with practice, the frustration level is high for him as a result of this (he gets very...
11
2581
by: Terry Olsen | last post by:
How can I catch a right-click on a DropDownMenuItem?
5
2124
by: wxnut | last post by:
In VB 2005 I have six seperately named picture boxes (arranged in a table layout control) in which I plot different X/Y data lines. I would like to be able to right-click on a specific picture box (say, plot #3) and select a different line color for that one plot. How can I figure out which of the six plots is the one in question when right-clicking on it? I can easily change the line color using the context menu control, but I don't...
8
4633
by: Chaitanya | last post by:
Hello, In my Application i want to know when user clicks both the "Left" and "Right" buttons of the Mouse. I am getting a number like this "3145728". But the MouseButtons Enum contains only Left, Right, Middle, None, XButton1 and XButton2. I am using .NET 1.1 version. How can i convert "3145728" to MouseButtons Enum? why Mouse Left+Right click not added to the Enum? Can anyone help me?
18
3964
by: Shocky | last post by:
Hi there, I am trying to detect whether my IE6 users have pressed both right and left mouse buttons simultaneously in my Javascript code, by using: if(event.button==3) {alert("Both right and left mouse buttons pressed");} I am calling the above code on mousedown or mouseup events.
0
9531
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.