473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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.thanking u in advance.
Jul 20 '05 #1
4 2067
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.javascript:
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);return false;"
oncontextmenu="location.href=this.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
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...
2
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...
4
by: John Bailo | last post by:
Is there any way to enable right click on a winform button?
3
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...
4
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...
13
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...
11
by: Terry Olsen | last post by:
How can I catch a right-click on a DropDownMenuItem?
5
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...
8
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,...
18
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.