How To Stop <li> Onclick Bubble-up...?

Jul 23, 2005

I'd like to show tree structures using collapsible multi-level nested <ul>
lists (with open/closed "disclosure triangles" as list-style-images).
Something like this:

<ul>
<li onclick="alert('Level 1 clicked');">Level 1
<ul>
<li onclick="alert('Level 2 clicked');">Level 2
</li>
</ul>
</li>
</ul>

Clicking on the text following <li> (or on the list-style-image)
collapses/expands the rest of the content of that <li> (not shown here).

The problem is that each click bubbles up to the topmost list item. That is,
a click on "Level 2" first executes the innermost <li> onclick handler, then
the one for the next-outer-level <li> and so on. How can I make it so that
only the handler for the <li> that's clicked is executed? (returning false
from onclick didn't help in IE 6)

(I know I could wrap the text in <span>s and add the onclick handlers to
those instead, but that's a bit ugly, and the list-style-image would be out
of action).

View 5 Replies


ADVERTISEMENT

Two Functions OnClick - Stop If First Is False?

May 10, 2006

I have two functions on buttons onclick, they work but if the first
fails the second still runs. How can I prevent this? Simplified Code
below.

Function Function1 () {
if (something) {
return false
}

Function Function2 () {
if (something) {
return false
}

onclick="Function1(); Function2()"

View 8 Replies View Related

Stop Page From Scrolling On An Onclick?

Jan 21, 2009

<input class='absmiddle' type='checkbox' name='chg' id='chg' onclick='toggle(this); return false;'>

I thought the return false would prevent this but the page scrolls up a bit. What's wrong?

View 2 Replies View Related

Stop Form Submit With OnClick?

Jul 30, 2010

I'm using an image as my submit button. I want it to check to ensure all boxes have a value before submitting (I will make the verification more stringent later), and if there is none, to cancel the form submission. I created a readonly input box that changes from white to a visible color to use as a status indicator for now.It displays the correct status in either scenario, but return false doesn't seem to be stopping the page from loading. What function would do that?

[Code]...

View 3 Replies View Related

JQuery :: Stop Page From Jumping To The Top OnClick?

Oct 26, 2009

My question is, what do I need to do to stop a browser from jumping to the top of the page when a user clicks on a link which has a jquery function attached to it?So for exampleUser clicks on a link called "Older Stories"Once they do that, jquery will load in some content AJAX styleHowever, browser has jumped to the top of the page and we have to scroll back down again to see the content which has just been loaded in.I've tried putting a return statement in my code but it didn't do anythingHere's my code

var content = $("#ajax_content");
$("#olderstories").click(function(){
showLoading();

[code]....

View 2 Replies View Related

Put Timer In Bubble Sort?

Oct 15, 2011

how to put timer in bubble sort using javascript?I am trying to make a timer for my sort but I can't make it. I don't know how to connect...

<html>
<head>
<title>sortBubble</title>

[code]...

View 1 Replies View Related

JQuery :: Popup Bubble With Dynamic Div Id?

Sep 6, 2010

I have a series of dynamic div ids like

<div id=dumm1>aaaa</div>
<div id=dumm2>bbbb</div>
<div id=dumm3>cccc</div>

Now onmouseover there is a popup bubble box appearing.

[Code]...

View 13 Replies View Related

Text 'bubble' Popup When Rollover?

Jun 1, 2002

is there a way to popup a small 'bubble' or 'balloon' of text when a user lets their pointer rest over a particular part of an image? (an image map)

explorer does this sometime (randomly it seems) when i let my pointer rest of an image that has alt text - it displays the alt text in a speech bubble thing - but only sometimes! so that is no good. also netscape doesn't have this and obviously i want something that'll work in both.

the reason i want to do this is this - i've got a simplyfied map (a geographical map) as a picture. there's a small piece of info i wish to show for each country, but the map is too small to allow me to put the information directly on the map - so i figured popup bubbles would be a good way.

View 7 Replies View Related

JQuery :: Fill A Bubble With The HTML Of A Hidden Div

Feb 22, 2011

I used the "CreateBubblePopup", filling it with html directly in javascript. Until now, it was working fine. For some reasons, now I need to write this HTML inside the page (in a hidden div), and then load this html inside the bubble when it's created. Here is the code :

HTML :
<a class="bubble" href="..." >
<img alt="Détail" src="plus.png" />
<div class="hidden">Here is the HTML that will be displayed in the bubble.</div>
</a>

[Code]....

It seams that my "popupHtml" variable is always null, no matter what the html in the hidden div is.

View 10 Replies View Related

Info Bubble Or Modal Screen For URL Links?

May 12, 2010

For each link I pull a few pieces of info for each, link name, link URL and a brief description. When a user clicks on the link I need to display a message that they are leaving the site and allow them to cancel or continue off the site. This can be either a bubble pop-up above/below the link or a modal window, displaying the 3 details (URL, Name, description) with an option to cancel and close the new bubble pop-up/modal window.

Yahoo News does an excellent job of the bubble pop-up but it's probably much more coding than I have time for. So my question is, is there code out there that I can implement on my site for this? I'm somewhat familiar with jQuery so if there's an existing example for this I'd love to hear about it.

View 2 Replies View Related

Make A Recursive Bubble Sort In Program?

Nov 4, 2010

how to make a Recursive Bubble Sort in my program.

This is the program.

<html>
<head>
<title>Javascript Random Number Generator.</title>
<style type="text/css">

[Code].....

View 2 Replies View Related

JQuery :: Gallery Page With A Popup Bubble When You Hover Over A Gate Type

Mar 31, 2011

I've built a gallery page with a popup bubble when you hover over a gate type, however this works fine on safari,firefox, but doesn't on explorer. [url]

View 2 Replies View Related

Script - Popup As A Bubble With Some Information - When Click On Any Form Element In A Page?

Mar 22, 2008

Do u know of any free javascript script that will popup as a bubble with some information on it when I click on any form element in a page?

I can show you an example of what I want:

View 3 Replies View Related

Confirm Doesn't Stop On Cancel / Stop It?

Nov 3, 2011

I m trying to make a person stay on same page on cancel, but the confirm takes the user to the next page like they press ok. how can i stop it? code...

View 1 Replies View Related

Event Bubble - Fire Wtf() Only When I Pull My Mouse Out Of The Whole "offer" (container) Div?

Feb 25, 2010

I have following code

Code:
<div class="menu_dot" onclick="slideMenu(this, 'offer', event);">Offers</div>
<div id="offer" onmouseover="" onmouseout="wtf(event, 'offer');">
<div class="menu_slide" onmouseout="return false;">Add</div>[code].....

the problem is that when i move mouse into the "offer" div within the div i put my mouse from the div with "Add" over "Search" the onmouseout event is triggerd and the wtf() function is fired. and i want to fire wtf() only when i pull my mouse out of the whole "offer" (container) div.

View 2 Replies View Related

Add A Stop Button To Stop The Clock?

Oct 19, 2010

How do I add a stop button to stop the clock. Here is my code below.

<HTML>
<HEAD>
<script language="Javascript1.2">
<!--

[Code]....

View 3 Replies View Related

Make An Onclick Event Change The Document.onclick ?

Sep 4, 2010

I want to make it so that when I click on something, it changes what document.onclick does.

This is a simplified version of what I'm trying to do:

Code:
<div id="clickme" onclick="document.onclick = function(){ alert ('This should not be alerted on the first click'); }">Click here</div>

However, as you'll notice, the alert box shows up on the first click as well. The only way I have been able to get around this behaviour is to have the first onclick execute a timer that will then set the document.onclick after 1ms, however this seems very messy to me.

View 1 Replies View Related

Stop Getting Intercepted In A Pop Up

Nov 11, 2005

<html>
<script type="text/javascript">
win=window.open();
var printDoc=win.document.open('text/html','replace');
printDoc.writeln(""211PNG

View 1 Replies View Related

Stop An Ad Box Floating?

Aug 10, 2009

I have a website that has an ad box to show the next event. after many hours i got the box to sit above a flash menu but it now floats and when people try to scroll to read the rest of the flyer it is always bellow the screen...

<style type="text/css">
<!--
#sponsorAdDiv {position:absolute; height:1; width:1px; top:0; left:0;}
-->

[Code]....

View 10 Replies View Related

Way To Stop A Function

Nov 9, 2011

How do I stop the displaymessage function when i ==1 code...

View 6 Replies View Related

How To Stop Countdown

Jun 10, 2011

I'm using a countdown timer in a student project, and I use a simple code that I find on google. My problem is when the clock ends at 0 min 0 sec, it continue with the count. I want to stop when reach 0 min 0 sec. I show you the code.

[Code]...

View 5 Replies View Related

Stop A Function?

Jun 22, 2006

i have a function, i want it to keep doing the function while the mouse is over a button and then stop when its off.....to repeat i can just call the function again at the end of the function like this:

onMouseOver="doFunction()"

doFunction() {
//do something
doFunction();
}

but how can i make a function stop to it onmouseout?

View 4 Replies View Related

Stop 2 Swf At Same Time?

Jul 7, 2009

I'm trying to control the playback of 2 swf's, embedded in a html page.They should play or stop at the same time when a play or stop button is clicked.It has to do with that getElementById thing I guess, but I know very little javascript. Can anyone help me out with this?

what script goes above the <head> in my doc, and what code goes with the imagemaps?

View 3 Replies View Related

OnClick In TR Conflicting With A Onclick

Aug 31, 2007

I have the following sample code and when I click the a href link it pops up both windows.

HTML4Strict Code:
<tr false;" style="cursor:pointer">    <td>Some data</td>    <td>More date</td>    <td><a href="thatlink.html" false;">Details</a></td></tr>

In other words - linking the link that should open up 'thatlink.html' opens up that window first followed by the 'thislink.html' window in the table row onclick call.

View 3 Replies View Related

Stop People Using Bandwidth

Jul 23, 2005

Does anyone have a good java script that I can add to my page so that the same user doesn't pound my site and use all of my bandwidth?

View 12 Replies View Related

Detecting Stop Button

Mar 6, 2006

I'm trying to determine if the user clicks the
stop button during a post send, basically. Specifically, if a user is
uploading a file to my server, and they click stop at some point, I
need to be able to tell the server that stop was clicked, so it doesn't
think that's the whole file. I've noticed that an error message is
written to the Apache log, but that seems like a strange way to keep
track of user-interrupted events. (Note: this is Apache/mod_perl
server-side)

I guess what I'm thinking now is that JavaScript detects the stop
(since it is client-side), then sends a message to the server that an
error occurred, or something. Like I said, the onstop event is not
doing what I'm expecting, and Firefox doesn't like it anyway, not to
metion the other browsers out there. So my question is what's the
"idiom" or "standard way" of detecting this sort of situation. I'm
quite certain I'm not the first one to need it.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved