javascript-events

Change event on <select>

If i attach a change event listener on a<select> how do i acces the option that was selected (not just the value, the actual element). $('select').addEvent('change',function(event) { //?? }); Note: i'm using Mootools ...

How to check keyboard state while painting on HTML5 canvas?

I'm just mucking around a bit with HTML5 canvas and painting. I happened to find this article by Opera that describes well how to set up a simple application. I would like to extend it so that the user may set up a vanishing point (1 point perspective) that may be used to constrain painting. To allow this I need to figure out a way to d...

Onchange event of Dropdownlist.

I have a dropdown list. I am using onchange event of this dropdown to show some text in a textbox below. Its perfectly fine. But i want to to do something like this:--- If user click on the drop down then the whole list will be populated. right.. Now if he is trying to choose the value from the list using up/down arrow button of the key...

@EventListener on contrib:MultiplePropertySelection (Tapestry 4.1)

Hi. Is it possible to add @EventListener to a contrib:MultiplePropertySelection in Tapestry 4.1 (dojo) and listen to onclick on its checkboxes? I would like to redraw the component everytime I click on a checkbox (as I'm toggling disabled and checked properties on the rest of them then). I would like to achieve this (Java): @EventListe...

click() (javascript) method is not working in FF

Hi, The following code is throwing two alerts as expected in IE but not in Firefox. Please help. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- function myFunction(){ alert('myfunc'); document.getElementById('mylabel').click(); } //--> </SCRIPT...

Check if 'onload' would have fired already?

Hello, I have a situation where I'd like to set an onload handler for a script element, but it is possible that the script element has already loaded before I do so. If it's already loaded, I'd like to detect that and run my handler immediately. What would be a reliable way of checking a script element's onload state after the fact? ...

Can I cancel location.href in javascript

It might sound silly, but I need this functionality. Can I somehow cancel location.href = 'url' in javascript once it is executed? for example on click of button i am changing current page with some resource intensive page, I want to give an option to user so that one can cancel it if next page is going to take long time to load. Tha...

How to check if a Textarea is empty in Javascript or Jquery?

How do i check if a textarea contains nothing? I tryed with this code if(document.getElementById("field").value ==null) { alert("debug"); document.getElementById("field").style.display ="none"; } But it doesnt do what i expect. I expect that it should appear a messagebox "debug" and that the textarea is not shown. How can...

disable f5 and browser refreshh using javascript

Hi All, I want to disable browser refresh using javascript. Actually i am using window.onbeforeonload abd i don't want it will be called when user refresh the browser. what is the best way to do it? Regards, Salil Gaikwad ...

Java. What to do with Choice()???

import java.awt.*; import java.awt.event.*; import java.applet.*; public class ChoiceSample extends Applet implements ActionListener, ItemListener { Choice dz2; public void init(){ dz2 = new Choice(); dz2.addItem("female"); dz2.addItem("male"); dz2.addItemListener(this); add(dz2); ...

window.onload seems to trigger before the DOM is loaded (JavaScript)

I am having trouble with the window.onload and document.onload events. Everything I read tells me these will not trigger until the DOM is fully loaded with all its resources, it seems like this isn't happening for me: I tried the following simple page in Chrome 4.1.249.1036 (41514) and IE 8.0.7600.16385 with the same result: both displa...

OnEdit / OnFocus Hook or Similar in Bespin Embedded?

I'm trying to implement a hook when text is edited in a bespin embedded instance. Ideally, I'd simply like to know when the instance has gained or lost focus to capture the user action. ...

How to trigger event in javascript

Hi guys, I have attached a event to a text box using addEventListener. It works fine. My problem arouse when i wanted to trigger the event programmatically from another function. how can i do it? ...

JavaScript Calender in edit item template of datagrid in asp.net

Hi friends, My problem is, i am using a Javascript calender in my datagrid in asp.net and wants to make update the date based on the selection on the calender's date while editing, which is not happening. Can any one help me to solve this problem. Code is as follows <asp:TemplateColumn HeaderText="Event Dt."> <ItemTemplate> <%#Con...

remove element in javascript

In the below code how to remove the hyperlink after getting the innerHTML function test(obj) { var a=obj.innerHTML //remove obj element here } $p = $('<a id="name" onclick="var ele=test(this);">').html( "test" ); $('#questions').append( $p ); Thanks.. ...

Remove preceeding tag

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); ...

Is there any events available for the reset option for input search ?

In HTML5 there is a new input type, 'search'. On most browser it's just remain to a simple 'text' input, but for webkit based browsers, it adds a little cross to reset the input. I'd like to be able to handle this, is there an event for that ? ...

how to listen for changes to the title element?

In javascript, is there a technique to listen for changes to the title element? ...

Chrome is leaking memory, when jQuery is used on events?

Hi, I'm experiencing an increase of memory usage, when I use the jQuery-eventhandling in Chrome. I've tested it with IE and FF as well, but there I couldn't see a suspicious rise of memory-usage, compared to Chrome. I'm using Chrome version 4.0.223.16 (unfortunately I'm forced to use this version, here) Simple example here. Just scrol...

getting value of another tag

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> Than...