Search Results

Search found 10381 results on 416 pages for 'delegate and events'.

Page 92/416 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • How do I cancel the link action?

    - by Tobbe
    I though returning false would be enough to cancel the link action, but apparently it isn't. When I click the link in the code below I do get the 'click' message, which is expected. But I also end up at google.com, which is unexpected. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Link test</title> <script> window.addEventListener('load', function () { document.getElementsByTagName('a')[0].addEventListener('click', function () { alert('click'); return false; }, false); }, false); </script> </head> <body> <a href="http://www.google.com">google</a> </body> </html> How can I make the url NOT change when clicking the link? Pure JavaScript solutions only please, no additional libraries (like jQuery). It only has to work in FireFox 3+ and Chrome.

    Read the article

  • Event Listner in php

    - by isurulucky
    Hi, I want my web server to notify me through a php page when an event occurs at a another TCP server, to which the php page has successfully connected via a socket. The event is like the TCP server want to send a message to the web server, etc. Is there any way to accomplish this and/or any references on how to do it??? Thank You!!

    Read the article

  • OpenLayers: Raise event when map is zoomed or moved by user

    - by David Pfeffer
    I'm using OpenLayers to display OpenStreetMap maps. (Though, I'd assume this should be general enough to work for any map product...) I'm displaying some very sophisticated vector overlays, and the amount and resolution of the features I'm returning from the server via GeoJSON to overlay has proven too much for many computers. What I'd like to do now instead is to only send data befitting the resolution of the current zoom, and fitting the current view port. This should be relatively easy to do using the GetResolution and CalculateBounds methods on the Map object. However, I don't know when to call these methods because I can't find a way to register a function to be called when the user pans the map (changing the view port) or zooms the map (changing the resolution and view port). How can I get a callback when the user pans or zooms the map?

    Read the article

  • Apache tiles and body onload event. Known issue?

    - by Angus
    We're prototyping a new visual framework using Apache Tiles for markup templating. Often the document onload event (actually prototype's dom:loaded event) is getting fired before all DOM objects are actually loaded Is it possible that the tiles templates are loading in an asynchronous fashion and therefore doing an end run around the event handler? Has anyone else had this experience? Can anyone share a robust workaround? thanks in advance

    Read the article

  • When onblur occurs, how can I find out which element focus went *to*?

    - by Michiel Borkent
    Suppose I attach an onblur function to an html input box like this: <input id="myInput" onblur="function() { ... }"></input> Is there a way to get the ID of the element which caused the onblur event to fire (the element which was clicked) inside the function? How? For example, suppose I have a span like this: <span id="mySpan">Hello World</span> If I click the span right after the input element has focus, the input element will lose its focus. How does the function know that it was mySpan that was clicked? PS: If the onclick event of the span would occur before the onblur event of the input element my problem would be solved, because I could set some status value indicating a specific element had been clicked. PPS: The background of this problem is that I want to trigger an Ajax.AutoCompleter control externally (from a clickable element) to show its suggestions, without the suggestions disappearing immediately because of the onblur event on the input element. So I want to check in the OnBlur function if one specific element has been clicked, and if so, ignore the blur event.

    Read the article

  • javascript select box hanging on second select in ie7

    - by bsandrabr
    I have a drop down select box inside a div. When the user clicks on change, a dropdown box appears next to the change/submit button and the user makes a selection which then updates the db and the selection appears instead of the dropdown. All works fine in IE8 and firefox but in IE7 it allows one selection (there are several identical dropdowns) but the second time a selection is made it hangs on please wait. This is the relevant code <td width=200> <input type="button" onclick="startChanging(this)" value="Change" /></td> <script type="text/javascript"> var selectBox, isEditing = false; var recordvalue; if( window.XMLHttpRequest ) { recordvalue = new XMLHttpRequest(); } else if( window.ActiveXObject ) { try { recordvalue = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} } window.onload = function () { selectBox = document.getElementById('changer'); selectBox.id = ''; selectBox.parentNode.removeChild(selectBox); }; function startChanging(whatButton) { if( isEditing && isEditing != whatButton ) { return; } //no editing of other entries if( isEditing == whatButton ) { changeSelect(whatButton); return; } //this time, act as "submit" isEditing = whatButton; whatButton.value = 'Submit'; var theRow = whatButton.parentNode.parentNode; var stateCell = theRow.cells[3]; //the cell that says "present" stateCell.className = 'editing'; //so you can use CSS to remove the background colour stateCell.replaceChild(selectBox,stateCell.firstChild); //PRESENT is replaced with the select input selectBox.selectedIndex = 0; } function changeSelect(whatButton) { isEditing = true; //don't allow it to be clicked until submission is complete whatButton.value = 'Change'; var stateCell = selectBox.parentNode; var theRow = stateCell.parentNode; var editid = theRow.cells[0].firstChild.firstChild.nodeValue; //text inside the first cell var value = selectBox.firstChild.options[selectBox.firstChild.selectedIndex].value; //the option they chose selectBox.parentNode.replaceChild(document.createTextNode('Please wait...'),selectBox); if( !recordvalue ) { //allow fallback to basic HTTP location.href = 'getupdate.php?id='+editid+'&newvalue='+value; } else { recordvalue.onreadystatechange = function () { if( recordvalue.readyState != 4 ) { return; } if( recordvalue.status >= 300 ) { alert('An error occurred when trying to update'); } isEditing = false; newState = recordvalue.responseText.split("|"); stateCell.className = newState[0]; stateCell.firstChild.nodeValue = newState[1] || 'Server response was not correct'; }; recordvalue.open('GET', "getupdate.php?id="+editid+"&newvalue="+value, true); recordvalue.send(null); } } </script> If anyone has any idea why this is happening I'd be very grateful

    Read the article

  • Detecting a image 404 in javascript.

    - by xal
    After a user uploads a file we have to do some additional processing with the images such as resizing and upload to S3. This can take up to 10 extra seconds. Obviously we do this in a background. However, we want to show the user the result page immediately and simply show spinners in place until the images arrive in their permanent home on s3. I'm looking for a way to detect that a certain image failed to load correctly (404) in a cross browser way. If that happens, we want to use JS to show a spinner in it's place and reload the image every few seconds until it can be successfully loaded from s3.

    Read the article

  • Is there anyway to prevent onbeforeunload event from triggering when using internet explorer

    - by newName
    I have a function that is suppose to trigger when user closes their browser and I have put the code in the "window.onbeforeunload" function. The thing is every time if I reloads the page in Internet Explorer, the onbeforeunload event will also trigger which is a problem because I only wants it to trigger only when the user closes or navigates away from the current page but not on a page refresh/reload. Therefore I'm not sure if onbeforeunload is intended to trigger even on a page refresh/reload and if it is intended to, then is there another way to work round it? Thanks

    Read the article

  • Javascript tabs: call event onclick

    - by Joris
    I got some code I need to change. it is build by others, and not very neat... There is a javascript tabcontrol, containing 4 tabs, which contains gridviews. All the 4 gridviews are build during the load of the page, but I want them to load, when you activate the tabs (as it is possible to watch the side, while you don't need the specific gridviews to see) So, my question is: how to call an event (that loads the gridview) from an javascript tab? how the tabs are generated: (generated code, I know, horrible) var obj = 0; var oid = 0; var otb = 0; var myTabs = new Array(); var myTabitems = new Array(); var myTabitem = new Array(); var myTabContent = new Array(); var myLists = new Array(); function showTabContent(tab) { tb = tab.obj; id = tab.nr; if (myTabs[tb].oid != -1) { myTabs[tb].myTabContent[myTabs[tb].oid].style.display = 'none'; myTabs[tb].myTabitem[myTabs[tb].oid].className -= " active"; } myTabs[tb].myTabContent[id].style.display = 'block'; myTabs[tb].myTabitem[id].className += " active"; myTabs[tb].oid = id; } function boTabs() { var myBlocks = new Array(); myBlocks = document.getElementsByTagName("div"); var stopit = myBlocks.length; for (var g = 0; g < stopit; g++) { if (myBlocks[g].className == "tabs") { myTabs.push(myBlocks[g]); } } var stopit2 = myTabs.length; for (var i = 0; i < stopit2; i++) { myTabs[i].myLists = myTabs[i].getElementsByTagName("ul"); if (myTabs[i].myLists[0].className == "tabs") { myTabs[i].myTabitems = myTabs[i].myLists[0].getElementsByTagName("li"); } var stopit3 = myTabs[i].myTabitems.length; myTabs[i].obj = i; myTabs[i].myTabitem = new Array(); myTabs[i].myTabContent = new Array(); for (var j = 0; j < stopit3; j++) { myTabs[i].myTabitem.push(myTabs[i].myTabitems[j]); myTabs[i].myTabitem[j].nr = j; myTabs[i].myTabitem[j].obj = i; myTabs[i].myTabitem[j].onclick = function() { showTabContent(this); }; } var myTabDivs = myTabs[i].getElementsByTagName("div"); for (var j = 0; j < myTabDivs.length; j++) { if (myTabDivs[j].className == "tabcontent") { myTabs[i].myTabContent.push(myTabDivs[j]); } } myTabs[i].myTabitem[0].className += " active"; myTabs[i].myTabContent[0].style.display = 'block'; myTabs[i].oid = 0; myTabDivs = null; } myBlocks = null; } onload = boTabs;

    Read the article

  • access exception when invoking method of an anonymous class using java reflection

    - by Asaf David
    Hello I'm trying to use an event dispatcher to allow a model to notify subscribed listeners when it changes. the event dispatcher receives a handler class and a method name to call during dispatch. the presenter subscribes to the model changes and provide a Handler implementation to be called on changes. Here's the code (I'm sorry it's a bit long). EventDispacther: package utils; public class EventDispatcher<T> { List<T> listeners; private String methodName; public EventDispatcher(String methodName) { listeners = new ArrayList<T>(); this.methodName = methodName; } public void add(T listener) { listeners.add(listener); } public void dispatch() { for (T listener : listeners) { try { Method method = listener.getClass().getMethod(methodName); method.invoke(listener); } catch (Exception e) { System.out.println(e.getMessage()); } } } } Model: package model; public class Model { private EventDispatcher<ModelChangedHandler> dispatcher; public Model() { dispatcher = new EventDispatcher<ModelChangedHandler>("modelChanged"); } public void whenModelChange(ModelChangedHandler handler) { dispatcher.add(handler); } public void change() { dispatcher.dispatch(); } } ModelChangedHandler: package model; public interface ModelChangedHandler { void modelChanged(); } Presenter: package presenter; public class Presenter { private final Model model; public Presenter(Model model) { this.model = model; this.model.whenModelChange(new ModelChangedHandler() { @Override public void modelChanged() { System.out.println("model changed"); } }); } } Main: package main; public class Main { public static void main(String[] args) { Model model = new Model(); Presenter presenter = new Presenter(model); model.change(); } } Now, I except to get the "model changed" message. However, I'm getting an java.lang.IllegalAccessException: Class utils.EventDispatcher can not access a member of class presenter.Presenter$1 with modifiers "public". I understand that the class to blame is the anonymous class i created inside the presenter, however I don't know how to make it any more 'public' than it currently is. If i replace it with a named nested class it seem to work. It also works if the Presenter and the EventDispatcher are in the same package, but I can't allow that (several presenters in different packages should use the EventDispatcher) any ideas?

    Read the article

  • Validation of textarea

    - by Hulk
    How to validate a textarea in a form.i.e, it should not be empty or have any new lines and if so raise an alert <script> function val() { //ifnewline found or blank raise an alert } </script> <form> <textarea name = "pt_text" rows = "8" cols = "8" class = "input" WRAP ></textarea> <input type=""button" onclick="val();" </form> Thanks

    Read the article

  • Simulating mouse clicks on Mac OSX does not work for some applications.

    - by Thomi
    Hi, I'm writing an App for Mac OSX 10.6 and later in C++. One part of theapp needs to simulate mouse movement and mouse clicks. I do this currently by posting CGEvent objects using CGEventPost(kCGHIDEventTap, event);. This works, for the msot part - I can simulate mouse movement and clicks just fine, but it seems to fail in some areas. For example: In Mozilla firefox & Safari, I can click on all the menus, but cannot click on a link within a website. When I try, the link is highlighted, but the browser never follows the link. However, I can right-click on a link, select "open link in new tab", and everything works as expected. I can click on the "Dashboard" icon to brink up the dashboard, but I cannot click on the "i" button on any of the dashboard widgets. This inconsistency is along application boundaries - Does anyone have any idea what the cause might be?

    Read the article

  • Simulating mouse clicks on Mac OSX does not work for some applications.

    - by Thomi
    Hi, I'm writing an App for Mac OSX 10.6 and later in C++. One part of theapp needs to simulate mouse movement and mouse clicks. I do this currently by posting CGEvent objects using CGEventPost(kCGHIDEventTap, event);. This works, for the msot part - I can simulate mouse movement and clicks just fine, but it seems to fail in some areas. For example: In Mozilla firefox & Safari, I can click on all the menus, but cannot click on a link within a website. When I try, the link is highlighted, but the browser never follows the link. However, I can right-click on a link, select "open link in new tab", and everything works as expected. I can click on the "Dashboard" icon to brink up the dashboard, but I cannot click on the "i" button on any of the dashboard widgets. This inconsistency is along application boundaries - Does anyone have any idea what the cause might be?

    Read the article

  • VB Equivalent of C# Event Creation

    - by Steven
    I'm trying to extend the GridView class to always show the header and footer even when the datasource is empty. I found this website: link. However, it is written in C# but I use VB. What's the VB equivalent of line 76 (public event MustAddARowHandler MustAddARow;)?

    Read the article

  • VB.net Net after load event?

    - by themaninthesuitcase
    I need some way of knowing when a form has finished loading. My reasoning is I have a 2nd form that is loaded when this form loads. The code for this is called from form1.load. Form2 is currently being displayed behind form1 as I am guessing form1 calls an activate or similar at the end of the load so any Activate, BringToFront etc calls on from2 are over ridden. If you look at the code below I have tried adding frmAllocationSearch.Activate, frmAllocationSearch.BringToFront and Me.SendToBack after the call to ShowAlloactionSearchDialog() but these are all wasted as something is happening after the load event is fired to bring Me to the front. Code is: Private Sub Allocation_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ShowAlloactionSearchDialog() End Sub Private Sub ShowAlloactionSearchDialog() If frmAllocationSearch Is Nothing OrElse frmAllocationSearch.IsDisposed Then frmAllocationSearch = New AllocationSearch frmAllocationSearch.MdiParent = Me.MdiParent frmAllocationSearch.Info = Me.Info frmAllocationSearch.Top = Me.Top frmAllocationSearch.Left = Me.Left + Me.Width - frmAllocationSearch.Width frmAllocationSearch.AllocationWindow = Me frmAllocationSearch.Show() Else If frmAllocationSearch.WindowState = FormWindowState.Minimized Then frmAllocationSearch.WindowState = FormWindowState.Normal frmAllocationSearch.Activate() End If End Sub

    Read the article

  • prototype/javascript - firefox not firing keypress/keydown event unless focus is in textbox

    - by Chloraphil
    The following works fine on IE6, IE7, and chrome. Not working on ff 3.0.7. <html><head> <script src="prototype.js" type="text/javascript" ></script> <script type="text/javascript"> Event.observe(window, 'load', function(){ Event.observe(document.body, 'keydown', myEventHandler); alert('window load'); }); function myEventHandler(evt) { alert(evt); } </script> </head> <body > <input type="text" /><br><br> </body></html> EDIT: By "not working" I mean myEventHandler is not firing in firefox. EDIT2: Furthermore, it works fine when focus is on the input element. I want it fire for all keydowns.

    Read the article

  • Dynamic Jquery Accordion

    - by kwek-kwek
    How do I default an accordion to be closed on start-up. here is the sample view here Here is the code: <script> $(function() { $("#accordion").tabs("#accordion div.pane", {tabs: 'h3', effect: 'slide'}); }); </script> <script> // add new effect to the tabs $.tools.tabs.addEffect("slide", function(i, done) { // 1. upon hiding, the active pane has a ruby background color this.getPanes().slideUp("slow").css({backgroundColor: "#fff"}); // 2. after a pane is revealed, its background is set to its original color (transparent) this.getPanes().eq(i).slideDown("slow", function() { $(this).css({backgroundColor: 'transparent'}); // the supplied callback must be called after the effect has finished its job done.call(); }); }); </script>

    Read the article

  • How to add event listners / signals to a simple superman class?

    - by Kabumbus
    I can and would love to use boost or std for this. Sorry - I am new to C++. So I created a really simple program like: #include <iostream> #include <string> using namespace std; class superman { public: string punch(){return cout << "superman: I hit the bad guy!" << endl;}; }; int main() { superman clark; clark.punch(); cin.get(); } I want to add an event listner that would tell me when clark punched and cout something like "superman punched!". How to add such event listner and event function to my class?

    Read the article

  • Page Loading Screen in PHP

    - by Palani
    Hi all, I am working on a Php page which loads more images,so I want to show the User as the Page is currently Loading. I have tried but it does not working correctly. The loading image should be run until all image gets load.How to implement for this?

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >