Search Results

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

Page 95/416 | < Previous Page | 91 92 93 94 95 96 97 98 99 100 101 102  | Next Page >

  • Javascript onunload form submit isn't submitting data

    - by Kevin
    I currently have form that checks if a user has unsubmitted changes when they leave the page with a function called through the onunload event. Here's the function: function saveOnExit() { var answer = confirm("You are about to leave the page. All unsaved work will be lost. Would you like to save now?"); if (answer) { document.main_form.submit(); } } And here's the form: <body onunload="saveOnExit()"> <form name="main_form" id="main_form" method="post" action="submit.php" onsubmit="saveScroll()"> <textarea name="comments"></textarea> <input type="submit" name="submit2" value="Submit!"/> </form> I'm not sure what I'm doing wrong here. The data gets submitted and saved in my database if I just press the submit button for the form. However, trying to submit the form through the onunload event doesn't result in anything being stored, from what I can tell. I've tried adding onclick alerts to the submitt button and onsubmit alerts to the form elements and I can verify that the submit button is being triggered and that the form does get submitted. However, nothing gets passed stored in the database. Any ideas as to what I'm doing wrong? Thanks.

    Read the article

  • How to catch GMail auto-refresh

    - by nameanyone
    I wrote a userscript to highlight the current row in GMail (indicated by the arrow). Unfortunately the highlight will only stay until GMail Inbox is auto-refreshed, which happens quite often. Is there a way to catch that event so I could reapply the highlighting? I don't want to do it on timeout. There is another userscript that does that and it loads up CPU.

    Read the article

  • How can I share an OnEnter event for a TcxGrid ?

    - by Roland Bengtsson
    I want to standardize the behaviour on an Devexpress TcxGrid. So I have a unit ClientData with a event: procedure TClientData.grdOnEnter(Sender: TObject); begin mnuCxGridStandardMenu.Grid := TcxGrid(Sender); end; If I try to use that event from a TcxGrid.OnEnter event in another unit it refuse to work. If I paste in ClientData.grdOnEnter then a dialog says it is not an valid identifier. Is it possible to share an event for several units in Delphi 2007 ?

    Read the article

  • Is there way to extend jQuery to handle a custom enter key event?

    - by Ken
    I write the following code all the time to handle when the enter key pressed: $("#selectorid").keypress(function (e) { if (e.keyCode == 13) { var targetType = e.originalTarget ? e.originalTarget.type.toLowerCase() : e.srcElement.tagName.toLowerCase(); if (targetType != "textarea") { e.preventDefault(); e.stopPropagation(); // code to handler enter key pressed } } }); Is there a way to extend jQuery so that I could just write: $("#selectorid").enterKeyPress(fn);

    Read the article

  • How to use OnKeyboardActionListener?

    - by backspace7
    Simply say, is there any example about 'OnKeyboardActionListener'? I want to call my method, whenever user type any character on keyboard. OnKeyListener or OnKeyDown is not called when the word is composing. <- it's a problem. So, I'm trying to use 'OnKeyboardActionListener' to solve the problem above.

    Read the article

  • Is there a more efficient way to set variables on a RadioButton's CheckChanged event?

    - by C Patton
    I have 16 radio buttons in an application of mine.. I have to set a variable based on which one was selected.. and I've produced some very ugly code doing this.. private void Foo_CheckedChanged(object sender, EventArgs e) { convertSource = 1; } private void Bar_CheckedChanged(object sender, EventArgs e) { convertSource = 2; } private void Baz_RadioButton_CheckedChanged(object sender, EventArgs e) { convertSource = 3; } Now, I've been thinking about it and to be honest I thought there might have been a way to do it with a switch.. I just can't conceptualize it in my mind. If anyone could show me a more efficient way of doing this, I'd really appreciate it. It's just really bugging me that such a simple thing as this is taking up fifty to seventy lines of code. thanks, cpatton

    Read the article

  • mouseover producing multiple images works in Firefox, but not i.e.

    - by tcantrel
    The code below allows the user to hover over 1 object and it not only replaces the object but also shows an additional object between the buttons. It works great in Firefox, but does not in Internet Explorer. HELP webpage: http://www.isp.ucar.edu/ Thx, Terri if ( < ocument.images) { img1on = new Image(); img1on.src = "images/buttons/button-beachon-on.gif"; img1off = new Image(); img1off.src = "images/buttons/button-beachon.gif"; img2on = new Image(); img2on.src = "images/buttons/button-bgs-on.gif"; img2off = new Image(); img2off.src = "images/buttons/button-bgs.gif"; img3on = new Image(); img3on.src = "images/buttons/button-iam-on.gif"; img3off = new Image(); img3off.src = "images/buttons/button-iam.gif"; img4on = new Image(); img4on.src = "images/buttons/button-nvia-on.gif"; img4off = new Image(); img4off.src = "images/buttons/button-nvia.gif"; img5on = new Image(); img5on.src = "images/buttons/button-utls-on.gif"; img5off = new Image(); img5off.src = "images/buttons/button-utls.gif"; img6on = new Image(); img6on.src = "images/buttons/button-water-on.gif"; img6off = new Image(); img6off.src = "images/buttons/button-water.gif"; img7on = new Image(); img7on.src = "images/buttons/button-exploratory-on.gif"; img7off = new Image(); img7off.src = "images/buttons/button-exploratory.gif"; // second image that does not appear in original button space img1ad = new Image(); img1ad.src = "images/buttons/beachon-overview-sm.gif"; img2ad = new Image(); img2ad.src = "images/buttons/bgs-overview-sm.gif"; img3ad = new Image(); img3ad.src = "images/buttons/iam-overview-sm.gif"; img4ad = new Image(); img4ad.src = "images/buttons/nvia-overview-sm.gif"; img5ad = new Image(); img5ad.src = "images/buttons/utls-overview-sm.gif"; img6ad = new Image(); img6ad.src = "images/buttons/water-overview-sm.gif"; img7ad = new Image(); img7ad.src = "images/buttons/exploratory-overview-sm.gif"; } function imgOn(imgName) { if ( < ocument.images) { document[imgName].src = eval(imgName + "on.src"); document["holder"].src = eval(imgName + "ad.src"); } } function imgOff(imgName) { if ( < ocument.images) { document[imgName].src = eval(imgName + "off.src"); document["holder"].src = "images/buttons/isp-overview-sm.gif"; } }

    Read the article

  • Access event.target in IE8 unobstrusive Javascript

    - by Mirko
    The following function gets the target element in a dropdown menu: function getTarget(evt){ var targetElement = null; //if it is a standard browser if (typeof evt.target != 'undefined'){ targetElement = evt.target; } //otherwise it is IE then adapt syntax else{ targetElement = evt.srcElement; } //return id of element when hovering over or if (targetElement.nodeName.toLowerCase() == 'li'){ return targetElement; } else if (targetElement.parentNode.nodeName.toLowerCase() == 'li'){ return targetElement.parentNode; } else{ return targetElement; } Needless to say, it works in Firefox, Chrome, Safari and Opera but it does not in IE8 (and I guess in previous versions as well). When I try to debug it with IE8 I get the error "Member not Found" on the line: targetElement = evt.srcElement; along with other subsequent errors, but I think this is the key line. Any help will be appreciated.

    Read the article

  • Why javascript IF only works one time?

    - by Emily
    I have javascript code which copy the value of input file and past it in the text box in real time. <script> function copyit(){ var thephoto=document.getElementById('thephoto').value; var fileonchange=document.getElementById('fileonchange').value; if(!thephoto==fileonchange){ document.getElementById('fileonchange').value=thephoto; } } window.setInterval("copyit()", 500); </script> Choose File : <input type="file" id="thephoto"><br> Here Is the file name : <input type="text" id="fileonchange"> Sadly this only works one time and then stops pasting the value when changing the file again. ( i mean you should reload the page to works again) Is IF has a cache or something? you can try the code by yourself to see. Thank you all

    Read the article

  • How to store (and use) the current mouse position?

    - by Ben Packard
    What is the best way to store the current mouse position (system-wide) and then (later) put the mouse at that stored point? [NSEvent mouseLocation] gets me the position, and I can move the mouse with a CGEventMouseMoved, but they each use a different co-ordinates system (I believe y=0 is the top for NSEvent and the bottom for a CGEvent). I'm worried about the robustness of capturing the screen height and using it to convert between the two - or is this the best approach?

    Read the article

  • Manipulate multiple check boxes by ID using unobtrusive java script?

    - by Dean
    I want to be able to select multiple check boxes onmouseover, but instead of applying onmouseover to every individual box, I've been trying to work out how to do so by manipulating check boxes by ID instead, although I'm not sure where to go from using getElementById,. So instead of what you see below. <html> <head> <script> var Toggle = true; var Highlight=false; function handleKeyPress(evt) { var nbr; if (window.Event) nbr = evt.which; else nbr = event.keyCode; if(nbr==16)Highlight=true; return true; } function MakeFalse(){Highlight=false;} function SelectIt(X){ if(X.checked && Toggle)X.checked=false; else X.checked=true; } function ChangeText() { var test1 = document.getElementById("1"); test1.innerHTML = "onmouseover=SelectIt(this)" } </script> </head> <body> <form name="A"> <input type="checkbox" name="C1" onmouseover="SelectIt(this)" id="1"><br> <input type="checkbox" name="C2" onmouseover="SelectIt(this)" id="2"><br> <input type="checkbox" name="C3" onmouseover="SelectIt(this)" id="3"><br> <input type="checkbox" name="C4" onmouseover="SelectIt(this)" checked="" disabled="disabled" id="4"><br> <input type="checkbox" name="C5" onmouseover="SelectIt(this)" id="5"><br> <input type="checkbox" name="C6" onmouseover="SelectIt(this)" id="6"><br> <input type="checkbox" name="C7" onmouseover="SelectIt(this)" id="7"><br> <input type="checkbox" name="C8" onmouseover="SelectIt(this)" id="8"><br> </form> </body> </html> I want to be able to apply the onmousover effect to an array of check boxes like this <form name="A"> <input type="checkbox" name="C1" id="1"><br> <input type="checkbox" name="C2" id="2"><br> <input type="checkbox" name="C3" id="3"><br> <input type="checkbox" name="C4" checked="" disabled="disabled" id="4"><br> <input type="checkbox" name="C5" id="5"><br> <input type="checkbox" name="C6" id="6"><br> <input type="checkbox" name="C7" id="7"><br> <input type="checkbox" name="C8" id="8"><br> </form> After trying the search feature of stackoverflow.com and looking around on Google I haven't been able to a find a solution that makes sense to me thus far, although I'm still in the process of learning so I fear I might be trying to do something too advanced for my level of knowledge.

    Read the article

  • Why wont this JS code work if its all on the same line?

    - by culov
    I'm writing HTML code for a java servlet. i first write the code in html/js so i can debug what im working on, and then ill make it a java string and put it in my servlet. My problem is that the code is working fine when i view it in ff from a local html file, but when i view it on my java servlet, it doesnt work because the js isnt getting called. what I did was format the html that my servlet generated so that its not all on a single line and ran the code again. This time it worked. I copied this working code into a browser address bar so that it will all be on a single line, and copied that code back into the script in my html file. Now, when the previously working code is on a single line, it doesnt work. Here's the formatted JS: var sMax var holder; var preSet; var rated; var request; function rating(num){ sMax = 0; for(n=0; n<num.parentNode.childNodes.length; n++){ if(num.parentNode.childNodes[n].nodeName == "A"){ sMax++; } } if(!rated){ s = num.id.replace("_", ''); a = 0; for(i=1; i<=sMax; i++){ if(i<=s){ document.getElementById("_"+i).className = "on"; document.getElementById("rateStatus").innerHTML = num.title; holder = a+1; a++; }else{ document.getElementById("_"+i).className = ""; } } } } function off(me){ if(!rated){ if(!preSet){ for(i=1; i<=sMax; i++){ document.getElementById("_"+i).className = ""; document.getElementById("rateStatus").innerHTML = me.parentNode.title; } }else{ rating(preSet); document.getElementById("rateStatus").innerHTML = document.getElementById("ratingSaved").innerHTML; } } } function rateIt(me){ if(!rated){ document.getElementById("rateStatus").innerHTML = document.getElementById("ratingSaved").innerHTML + " "+me.title; preSet = me; rated=1; sendRate(me); rating(me); } } function sendRate(sel){ alert("Your rating was: "+sel.title); addRating("rating", "?truck=kogibbq?rating="+ sel.id); } function addRating(servletName, servletArguments){ var servlet = servletName; var arg = servletArguments var req = servlet + arg; alert(req); addrequest(req); request.onreadystatechange = function(){ alert("response received"); } } function addrequest(req) { try { request = new XMLHttpRequest(); }catch (e) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); }catch (e) { alert("XMLHttpRequest error: " + e); } } request.open("GET", element, true); request.send(null); return request; } Thanks.

    Read the article

  • The Webbrowser DocumentComplited event wont fire c#

    - by Igal B.
    Hi. I have a problem using C# Webbrowser control. the problem is with the event DocumentComplited. Usually the event works fine. the problem is with this page:http://www.voiproblem.com/emulators/Netgear/WGR614v6/fw_forward.html when I (automatically) press on "add" the control navigates to:http://www.voiproblem.com/emulators/Netgear/WGR614v6/pforward.html. but it never firing the DocumentComplited event. I build a simple application that does the same and there it works fine. I mean when the app invokes InvokeMember("click") it does go to the DocumentComplited event. in my real app it doesnt. anyone can help me to figure it up what is the problem? thanks. <code> private void button1_Click(object sender, EventArgs e) { webBrowser1.Navigate("http://www.voiproblem.com/emulators/Netgear/WGR614v6/fw_forward.html"); } private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { HtmlElement elm = webBrowser1.Document.GetElementById("Add"); if (elm != null) webBrowser1.Document.GetElementById("Add").InvokeMember("click"); } </code>

    Read the article

  • NorCal Weekly .Net is Up Now! Catch All for the .Net Events in Northern California!

      Ive always wanted a place that I could look through to find what .net events are going on in Northern California.  Ive found that there is a core group of people with common interested... This site is a resource for asp.net web programming. It has examples by Peter Kellner of techniques for high performance programming...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Flex: Result event given multiple times

    - by Tom
    Hello everybody!! I am trying to learn Flex and now i have the next code: http://pastebin.com/rZwxF7w1 This code is for my login component. I want to get a special string for encrypting my password. This string is given by my authservice. But when i login i get a multiple times a alert with Done(line 69 in the pastebin code or line 4 in the code on the bottom of this question). But i want that it shows one single time. Does someone know what is wrong with this code? Tom protected function tryLogin():void { encryptStringResult.addEventListener('result', function(event:ResultEvent):void { var encryptString:String = event.result.toString(); Alert.show('Done'); }); encryptStringResult.token = auth.getEncryptString(); }

    Read the article

  • How can I make my Perl Jabber bot an event-driven program?

    - by TheGNUGuy
    I'm trying to make a Jabber bot and I am having trouble keeping it running while waiting for messages. How do I get my script to continuously run? I have tried calling a subroutine that has a while loop that I, in theory, have set up to check for any messages and react accordingly but my script isn't behaving that way. Here is my source: http://pastebin.com/03Habbvh # set jabber bot callbacks $jabberBot-SetMessageCallBacks(chat=\&chat); $jabberBot-SetPresenceCallBacks(available=\&welcome,unavailable=\&killBot); $jabberBot-SetCallBacks(receive=\&prnt,iq=\&gotIQ); $jabberBot-PresenceSend(type="available"); $jabberBot-Process(1); sub welcome { print "Welcome!\n"; $jabberBot-MessageSend(to=$jbrBoss-GetJID(),subject="",body="Hello There!",type="chat",priority=10); &keepItGoing; } sub prnt { print $_[1]."\n"; } #$jabberBot-MessageSend(to=$jbrBoss-GetJID(),subject="",body="Hello There! Global...",type="chat",priority=10); #$jabberBot-Process(5); #&keepItGoing; sub chat { my ($sessionID,$msg) = @_; $dump-pl2xml($msg); if($msg-GetType() ne 'get' && $msg-GetType() ne 'set' && $msg-GetType() ne '') { my $jbrCmd = &trimSpaces($msg-GetBody()); my $dbQry = $dbh-prepare("SELECT command,acknowledgement FROM commands WHERE message = '".lc($jbrCmd)."'"); $dbQry-execute(); if($dbQry-rows() 0 && $jbrCmd !~ /^insert/si) { my $ref = $dbQry-fetchrow_hashref(); $dbQry-finish(); $jabberBot-MessageSend(to=$msg-GetFrom(),subject="",body=$ref-{'acknowledgement'},type="chat",priority=10); eval $ref-{'command'}; &keepItGoing; } else { $jabberBot-MessageSend(to=$msg-GetFrom(),subject="",body="I didn't understand you!",type="chat",priority=10); $dbQry-finish(); &keepItGoing; } } } sub gotIQ { print "iq\n"; } sub trimSpaces { my $string = $_[0]; $string =~ s/^\s+//; #remove leading spaces $string =~ s/\s+$//; #remove trailing spaces return $string; } sub keepItGoing { print "keepItGoing!\n"; my $proc = $jabberBot-Process(1); while(defined($proc) && $proc != 1) { $proc = $jabberBot-Process(1); } } sub killBot { print "killing\n"; $jabberBot-MessageSend(to=$_[0]-GetFrom(),subject="",body="Logging Out!",type="chat",priority=10); $jabberBot-Process(1); $jabberBot-Disconnect(); exit; }

    Read the article

  • Javascript display property

    - by Nani
    In my form I have a textbox and a calendr along with other controls asp:TextBox ID="TextBox2" runat="server" onfocus="CalOpen()" asp:TextBox asp:Calendar ID="Calendar1" runat="server" style="display:none;" onselectionchanged="Calendar1_SelectionChanged" script type="text/javascript" function CalOpen() { var cal = document.getElementById('<%=Calendar1.ClientID%>'); cal.style.display='block'; } /script protected void Calendar1_SelectionChanged(object sender, EventArgs e) { TextBox2.Text = Calendar1.SelectedDate.ToLongDateString(); Calendar1.Visible = false; } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Calendar1.Visible = true; } For the first time it worked fine, but, 2nd time when I click TextBox2, that is, after selecting date for the first time. Broeser is throwing error"object required" I am unable to know where I went wrong. Plz help me in making my code correct. Thank You.

    Read the article

  • Remove preceeding tag

    - by Hulk
    If there is a tag as <p id="name" onclick="javascript:var ele=context(this);">sumtext here</p><br> <p id="name" onclick="javascript:var ele=context(this);">newtext here</p><br> <script> function context(obj) { var b = document.getelementbyID("area"); b.removeChild(obj); //How to remove the preceeding element i.e,<br> } </script> <textarea id='area' rows="4" cols="70"></textarea> <p> and <br> are not in a div and so if i remove <p> how to remove the preceding tag br from javascript

    Read the article

  • getting value of another tag

    - by Hulk
    In the below code onclick edit how can the value of tag test be obtained in the edit function. <script> function edit(a) { } var a= <tr class="clickable"><td id="userval" BGCOLOR="#FF6699"><label id="test">' + a + '</lable>&nbsp;&nbsp;&nbsp; <IMG SRC="edit.gif" onclick="javascript:edit(test.value);" > ></td></tr> </script> Thanks.

    Read the article

  • Silverlight Custom Control Create Custom Event

    - by PlayKid
    Hi There, How do I create an event that handled a click event of one of my other control from my custom control? Here is the setup of what I've got: a textbox and a button (Custom Control) a silverlight application (uses that above custom control) I would like to expose the click event of the button from the custom control on the main application, how do I do that? Thanks

    Read the article

< Previous Page | 91 92 93 94 95 96 97 98 99 100 101 102  | Next Page >