LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-29-2015, 07:14 AM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,291

Rep: Reputation: 52
How can I disable onClick of onMouseOver/Out


I have the following html code which passes the W3C validator, I need to suppress its "onClick" ability, how can I do that?

In other words, when the cursor passes over the blue link, it renders the wanted HTML document as expected but if the link is accidentally clicked, the page reloads from the beginning and this is what I want to avoid, I need the onMouseOver/Out effects but not the onClick effect. This is in a Frameset document.

Code:
<table width="100%" border="20px" cellpadding="20px" bgcolor="#FF33CC" style="border-style: solid;border-color: #336666; color: #FF3300;"><tr bgcolor="#CCFF33" align="center"><td width="50%"><i>"When buying and selling are controlled by legislation, the first things to be bought and sold are legislators.<br><A HREF="" onMouseOver="window.status='About the Author: ` authors/Rourke.htm`'; parent.panl.location=' authors/Rourke.htm'; return true" onMouseOut="window.status='Table Of Contents'; parent.panl.location='../toc.htm'; return true">P. J. O`Rourke</A></i></td></tr></table>
There are a few examples on the Net on how to disable onMouseOver/Out with onClick but nothing about disabling onClick with onMouseOver/Out.

Any advice welcome.

Thank you for your help.

PS Changing return true to false makes no difference.
 
Old 06-29-2015, 09:25 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
If it were a <span>, not an <a> you shouldn't worry about 'href'
(I sort of remember having suggested that to you in another topic.)

PS: line-breaks are allowed in html:
Code:
<table width="100" border="20px" cellpadding="20px" bgcolor="#FF33CC" style="border-style: solid;border-color: #336666; color: #FF3300;">
<tr bgcolor="#CCFF33" align="center">
<td width="50%">
<i>"When buying and selling are controlled by legislation, the first things to be bought and sold are legislators.<br>
<span 
   onmouseover="window.status='About the Author: ` authors/Rourke.htm`'; parent.panl.location=' authors/Rourke.htm'"
   onmouseout="window.status='Table Of Contents'; parent.panl.location='../toc.htm'">
P. J. O`Rourke
</span>
</i></td></tr></table>

Last edited by NevemTeve; 06-29-2015 at 09:30 AM.
 
1 members found this post helpful.
Old 06-29-2015, 03:11 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Quote:
I need the onMouseOver/Out effects but not the onClick effect. This is in a Frameset document.
a REQUIREMENT!!!
or just what you "WANT"

i do not know about others
BUT 'on mouse' pop up's and text files
I HATE WITH A PASSION

as in i almost want to DDOS sites that use them


you really need to think about the user
this is not 2001 and they are not "newish" fun eye-candy

but rather annoying leftovers from GeoCities days
 
1 members found this post helpful.
Old 06-29-2015, 07:38 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Well, I think that the f-i-r-s-t thing that I would do here is: get rid of the "in-line statements!"

"An HTML declaration is no place for 'statements that actually do something!'"

Instead, those statements ought to be ... at least ... "calling JavaScript subroutines." The environment in which those subroutines operates should have been established onload. Then, any onClick, onMouseOver, onMouseOut, etc. directives should merely result in "subroutine or method-calls."

Now, you've established a JavaScript context that can actually be aware of the global state of the page. In other words, now it is in a good position to know that, e.g., "the mouse must be 'over something,' because I know that I have been informed of a 'mouseOver' event but that I have not yet been informed of 'MouseOut.'" Armed with such knowledge, the JavaScript logic knows whether or not it should actually do anything, when it is informed of a "MouseClick."

Mind you: "the 'MouseClick' event is not 'disabled!'" Instead, it is "ignored." The JavaScript subroutine gets called, but it decides not to do anything in this case, based on its awareness of what has (or, has not ...) happened in the recent past. The key point is ... "now, it has been maneuvered into the position to know." It ... being a single JavaScript context ... now will receive notification of all three of these events as they occur. Therefore, it will know in each case what (if anything) to do.

Last edited by sundialsvcs; 06-29-2015 at 07:39 PM.
 
1 members found this post helpful.
Old 06-29-2015, 08:18 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
While I would agree with what sundialsvcs has said about not putting javascript inline in the HTML, if you just want to ignore an onClick event there is not much point in doing anything more than this...

Code:
<element ... onClick="return false;" ... />
 
1 members found this post helpful.
Old 06-30-2015, 03:13 AM   #6
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,291

Original Poster
Rep: Reputation: 52
Thank you all, I will shortly try the suggestions.

To John VV, the site is purely plain text giving a lot of explanations (over 1G of it), to break the eye-strain and support the text we have interspersed quotes by reputable authors, quotes which are rendered inside blocks of various colors but we want the visitors to be able to assess for themselves if the quotes are, in their view, worth their salt or not, hence the onMouseOver/Out which calls a small html document giving a short description of who the author is and at what time they lived, if you have a better way of accomplishing this (which is a requirement) I will be delighted to read it since the possible annoying aspect of it is worth considering. It is not a matter of "pop-ups" disrupting anything at the slightest move of the mouse but as the example shows, being activated when the mouse passes in the colored block over the name of the author and including those details in the quote could in itself be very annoying and distracting.
 
Old 06-30-2015, 03:36 AM   #7
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
I might create one line dotjs file say "disable_on_click.js" that contains

document.write("OnClick=return false") ;

and include it in line with <script>disable_on_click.js</script> appropriately.

OK

Last edited by AnanthaP; 06-30-2015 at 03:37 AM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML onClick problem rblampain Programming 3 06-20-2015 08:45 AM
WGET javascript onclick delevel Linux - General 3 07-05-2011 06:28 AM
onMouseOver question rblampain Programming 3 01-06-2011 07:11 AM
javascript onclick event nightmare ... plk Programming 4 10-15-2008 07:35 AM
onMouseOver/onMouseOut question rblampain Programming 2 02-28-2008 07:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration