javascript-events

Hooking a synchronous event handler on a form submit button in JS

Hi, I'm working on a security project in javascript (something I honestly have not used), and I'm having some trouble with EventListeners. My code looks something like this: function prevclick(evt) { evt.preventDefault(); document.loginform.submitbtn.removeEventListener('click',prevclick,false); var req = new XMLHttpRequest(); req.open...

Display contents of a file

there is a file as data.html.How to display the contents of this file using javascript or jquery Thanks.. ...

clickable hyperlink behind image

I'm using the LinkedIn Profile widget on my site and am using the popup version. Although it's functional, I don't like the little LinkedIn icon that's placed as I'm already using a larger LinkedIn icon. Is it possible to hide the smaller one? (I assume it's built into the class, but there may be an option somewhere?) If not, is it possi...

jquery change event not working with IE6

It is indeed quite unfortunate that my client still uses IE6. using jquery 1.4.2 The problem is that I open a window using a click event and do some edit operation in the new window. I have a 'change' event attached to the row of a table which has input fields. Now when the window loads for the first time and I make a change in the inpu...

How to run code when elements are attached like jQuery's live() do with events?

I would like to run some code right after a certain set of elements are attached. jQuery.live() allows you to bind event handlers to elements, even if they are created later. But AFAIK there is no suitable method to do something like the following: $("some selector").live("attach", function() { $(this).whatever(); }); How can I accomp...

jQuery unbinding click event when maximum number of children are displayed

I have a personal details form that alows you to enter a certain number of dependants which is determined by the JSP application. The first dependant is visible and the user has the option to add dependants up to the maximum number. All other dependants are hidden by default and are displayed when a user clicks the 'Add another dependa...

Test whether image loaded correctly with JavaScript

I have an image deployed on several application servers (green up arrow: uparrow.gif). I have an application server status page where I list out all the servers and with a corresponding image where the image's source is the uparrow.gif for that server. If the image does not load (server down) I would like to switch to a red down arro...

Highlighting text beween custom tags

In a xhtml, i want to highlight the text between two self closing tags s1 and s2 whose attribute "ind" has the same value. Eg. <s1 ind="1"/> and <s2 ind="1" /> Eg. <html> <body> <a> <b>Some <s1 ind="1"/> text></b> <c>data <s2 ind="1"/>here</c> </a> </body> </html> I want "text data" to get highlighted. Is is possible to achi...

Javascript onclick event is not working in internet explorer 8.

Hi, I have the following line of code that works fine in Firefox, Chrome and Safari, but not in internet explorer 8. <a href="javascript:void(0);" onclick="showHide('reading','type_r','r');">Show me the example</a> The function simply shows and hides a div on clicking the hyperlink. Is there anything I'm missing here? This is the sh...

is this correct syntax to create onclick event on dynamic html document

var val1=document.createElement("input"); val1.setAttribute('type',"image"); val1.setAttribute('src',"../images/delete.gif"); val1.setAttribute('id',chkid); val1.setAttribute('name',"val2"); val1.setAttribute('class',"mylist2"); val1.onclick=function(){var block=document.getElementById("repeat_ul"); var obj=document.getElementByI...

javascript and css working on firefox but not working on IE

Hi I have this code which working on fitrefox but not working on IE missing last charector on IE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=ut...

A problem of trying to implement scrolling inertia with jQuery

I'm trying to add some iPhone style scrolling inertia to a web page that will only be viewed on the iPad. I have the scrolling working in one direction (scrollLeft), but it doesn't work in the other direction. It's a pretty simple function function onTouchEnd(event){ event.preventDefault(); inertia = (o...

Capture *all* display-characters in JavaScript?

I was given an unusual request recently that I'm having the most difficult time addressing that involves capturing all display-characters when typed into a text box. The set up is as follows: I have a text box that has a maxlength of 10 characters. When the user attempts to type more than 10 characters, I need to notify the user that th...

How do I cancel the link action?

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"&gt; <html> <...

How do I convert some ugly inline javascript into a function?

I've got a form with various inputs that by default have no value. When a user changes one or more of the inputs all values including the blank ones are used in the URL GET string when submitted. So to clean it up I've got some javascript that removes the inputs before submission. It works well enough but I was wondering how to put this...

MooTools - Programmatically fired events not working with event delegation

Would really appreciate if anyone can help me figure out why I am unable to fire events programmatically when using event delegation in MooTools (from the Element.Delegation class). There is a parent <div> that has a change listener on some child <input> elements. When the change event is triggered by user actions, the handler on the pa...

move caret to the end of a text input field AND make the end visible

I'm going insane. I have an autosuggest box where users choose a suggestion. On the next suggestion selection the value of the text input box exceeds its size. I can move the carat to the end of the input field crossbrowser, no problem. But on Chrome and Safari I cannot SEE the carat at the end. The end of the text is not visible. Is th...

Dynamics CRM 4.0 J Script - 'If' statement using statecode

Hi I am trying to create a simple alert as an onload event on the contact entity. However, I only want this to trigger if one of the conditions is that the contact is still active. I therefore put it the following: if (crmForm.all.statecode.DataValue == 0) { alert("'Whatever alert I want") ; } However, when I load the contact reco...

While Mouse press event. Prototype JS or Javascript

Hi, I would like to know if someone knows how to make a function repeat over and over while the mouse is press, I don't know how to make it work. I know in prototype you can take events like $('id').observe("click",function(event){}) $('id').observe("leave",function(event){}) $('id').observe("change",function(event){}) //etc... but ...

Can I pass a string variable into an <a href> tag for a website link?

I am somewhat new to web developing, so I am trying to learn along the way. I have a div that is 500 x 500. Inside of that div I have two divs that are each 250x500. So my outer div is filled up with the two inner divs. I have it setup so that when I click on the first div (the left one) a java script is called, and a prompt pop up box...