Why is this "onclick" not working?

  • xaccrocheur
  • Novice
  • Novice
  • User avatar
  • Posts: 20
  • Loc: paris fr

Post 3+ Months Ago

Hi guys

I'm trying to get this menu system working, it comes from http://www.brainjar.com and it's pretty cool, but I don't understand Why the toplevel entries are not active (ie: nothing happens when you click on it) even when the status bar of the browser IS displaying the href link !
DEMO_PAGE = http://www.coatmeur.cineteck-fr.com/BioSPIP_2_6/
I guess it's a Firebird bug, but I don't want to ADMIT it ! I'm going to find a workaround, because my client won't understand that their toplevel menu links are not working...

I tried to pass the command "location.href='rubrique.php3?id_rubrique=1'" in the onclick, to FORCE the link behavior, but to no avail.

I'm a very bad javascripter, so maybe this is where I did wrong...

HELP ?

Code: [ Select ]
<a onmouseover="buttonMouseover(event, 'menu1');" onclick="return buttonClick(event, 'menu1');location.href='rubrique.php3?id_rubrique=1';status='plop'" href="rubrique.php3?id_rubrique=1" class="menuButton" style="color: #FF9900;font-weight:bold">Soci&t&</a>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • the_Maven
  • Graduate
  • Graduate
  • the_Maven
  • Posts: 196

Post 3+ Months Ago

Hey, this is an opinion...

I don't like using the Onclick method, because when i test it, it works the first time, and won't work again until i reload the page. A way around this is to place the url call into a function. example:
Code: [ Select ]
<script language="javascript" type="text/javascript"
function getPage() {
open ("urlofnewpage" "NameofNewWindow");
}
</script>
  1. <script language="javascript" type="text/javascript"
  2. function getPage() {
  3. open ("urlofnewpage" "NameofNewWindow");
  4. }
  5. </script>

..more code...
Code: [ Select ]
<a href="javascript:getPage()">link text</a>

I took the liberty in bolding it so you could see how the function was called. I hope this helps.

- The Maven

------------------------------------------------
The Maven - please use the bbCode when posting code. Otherwise it usually won't display properly and can sometimes screw up the whole post. When using the "code" option normal markup like bold won't work.
ATNO

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 118 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.