javascript

JavaScript: Visibility error in Internet Explorer when setting focus on an input element

This may be the most obscure bug I have yet encountered in many years of working with JavaScript and any version of Internet Explorer. We're using YUI 2.7 for some of the (non)convenience methods. Sigh, what I would do for jQuery.... This is affecting Internet Explorer 6 and Internet Explorer7. Internet Explorer 8 behaves properly. All ...

How to use Jquery.Validate plugin with a iframe?

Hi I have a Rich Html editor called JhtmlArea and it makes a Iframe over a textarea. I have a validation set on this textarea but since JhtmlArea makes a Iframe it hides the textarea and nothing is every inserted in this. So my validation will never fire. So how can I validate a iframe with jquery.validate? http://jhtmlarea.codeplex.c...

Different background position every click

Hi, Im trying to build sort of slide where when click on link ".animate" will change it position ( every time 100px more) This: $(function(){ $('#m-main').click(function(){ $('slide').animate({top : "100px"}, {duration:500}) }) }); will work only once. How can I make this working? Many thanks for your help. ...

jQuery: Load background image from css class into variable?

How can I load the background-image (url) from a css class into a JavaScript variable (preferably using jQuery) ? Example: .myCssClass { background-image: url(/images/checkered.gif) no-repeat; } ...and now load checkered.gif into a var CheckeredGraphic = ??? using JavaScript. ...

Question on Code in Mozilla's Array.prototype.indexOf

This is Mozilla's Code in Mozilla's Array.prototype.indexOf if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt) { var len = this.length >>> 0; // What does ">>>" do? var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from): Math.floor(from); if (from < 0)from += len; for (;...

minifying patched javascript files

I'm writing a Rails app and I've partially integrated in this nice little patch to the in line ajax editor: http://inplacericheditor.box.re/ The problem is, on that page I have tinymce, prototype and scriptaculous included. In Firefox at least there's a big lag when all this stuff is loading. I was hoping to fix it by compressing the fi...

How to control indentation after an open parenthesis in Emacs

When I use emacs python-mode, if the last character of a line is an open parenthesis it indents the next line just one step in from the indentation of the previous line. call_some_function( some_very_long_argument_that_I_want_to_put_on_its_own_line) I like that. Now in ecmascript-mode (which I am using for actionscript 3), it alwa...

How to list all registered events of a DOM node using Javascript?

I can add or remove an event handler for a DOM node. Is it possible to find out all the registered events handlers of a given DOM node? I am referring to straight Javascript meaning no frameworks or toolkits like jquery, dojo, Prototype, GWT, etc. If the answer is no, any reason why? Security issues? ...

space tree javascript problem ...

I am using space tree Java script for creating a organisation chart . now that works fine an all but the problem is i am not able to print the chart properly . i am only able to print the art of the chart which is visible.. and that really doesn't bode well for my project so if anybody can suggest an alternate script for printing or some...

jquery: Passing this to child function

I have something like this: $('element.selector').live("click", function (){ run_some_func (); }); $('element.selector2').live("click", function (){ run_some_func (); }); Now in the function I need to use $(this): function run_some_func () { $(this).show(); } How do I get the function to know that $(this) is element.selector...

Window parent not working in IE 8

I have a parent page and a child page. By using window.opener.parent property,I am able to read the parent page content and display it in the child page.(There is a PREVIEW button on parent page,on click of which the child page opens up as a popup and displays the content of parent page controls.) This functionality was working fine in ...

Whats the easiest way to reactive a submit() action that was cancelled with 'return false'

I have some image buttons that have jQuery event handlers attached to them. I want to make an AJAX call in the click() event to determine if the action should actually be allowed. Because I am doing an async ajax call I have to return 'false' to immediately cancel the event and wait for the response. $('[id^=btnShoppingCartStep_]').cli...

JQuery: Open popup after hovering

Hi there, I'm using ASP.NET with C# I need to display a popup panel (doesn't have to be a panel) when i hover over a UI element. The user may click on buttons on the panel which will envoke Ajax calls How can i go about this? Any code samples? ...

I need help understanding a simple JavaScript script

if(document.frmMain.POL_NO.value == "") { alert("Select Policy Number"); document.frmMain.ENDT_NO.value=""; document.frmMain.POL_NO.focus(); return false; } Can anyone explain the above code to me? I am new to Javascript. ...

Javascript: parent.frmMain.hidChgType.value = "1"

if (lVarScript == 'CN_TYPE') { parent.fnEffDateCheck(); document.frmMain.hidChgType.value = '1'; parent.fnChangeType(); } wat doest the above code means? ...

Why does removeChild() prevent me from doing appendChild() within a Javascript Function?

In this code when I call the cleanGrid() function my goal was to get rid of the div that was class 'circle' and to replace it with a div with class 'square'. For what I'm really using this code for they are not replacable items so replaceChild() would not work. If I comment out the function call to cleanGrid() the code runs fine and the ...

Totally JavaScript Web Stack - Middleware, Webserver, DB suggestions?

Hi Everyone I'm currently looking for a new web stack to build a hobby project on and would like it to be powered by JavaScript. I've had a quick look at Nitro, NarwhalJS etc. but was wondering if anyone had any solid recommendations or experience of an entire end-to-end javascript/json architecture ( jquery, middleware, standard libra...

change backcolor of part of text using javascript ?

i have some part of text with html tags , for example <b>something</b> i select some part of text for example "some". with getSelection().getRangeAt(0); i get position of caret (textcursor), so i know which part of text i've selected. i have startOffset and endOffset. but problem is, that startOffset and endOffset ignores html ta...

JQuery, regular update of a DIV section

Hi, I want to do display time-changing data on a web page. I use the JQuery framework. I use the following code as a test : display a different random number each second. It does not work. Why ? What is a correct, working way ? <html> <head> <title>test</title> <script type="text/javascript" src="jquery-1.3.2.min.js"></scrip...

Using yui to customise select boxes

Hi, I know how to customize select boxes using such techniqiues as http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/ however Im trying to figure out if yui provides such functionality. Thanks. ...