javascript

What is the performance impact of having jquery functions not used?

I posted another question on a very similar topic, but turned out to be a little subjective. I am able to divided the question in two questions, one that I will explain below: In the following Code: <script type="text/javascript"> $(function() { $("#accordion").accordion(); $("#datepicker").datepicker(); $("#button").click(f...

Extjs TreePanel: How can I hide nodes by class or attribute?

I have a tree with nodes that contain tasks. Completed tasks have attribute status: 100 and class cls: "done". I would like to make a button for hiding completed tasks. What function will hide nodes in a tree by their id or class? {"id":"45", "description":"Pay bills", "status":"100", "cls":"done", "uiProvider":"col", "leaf":true} ...

Is there a javascript equivalent of python's __getattr__ method?

In python you can define a object having __getattr__(self,key) method to handle all unknown attributes to be solvable in programmatic manner, but in javascript you can only define getters and setters for pre-defined attributes. Is there a generic way of getting the former thing done also in javascript? Sample code would be smth like: f...

Confirm Delete on Javascript Remove Event

I'm using a javascript call to dynamically remove a field from a form. My problem is that the action happens very quickly, and it's not reversible. So I'd like to add the standard Rails delete confirmation, but I can't figure out how to make it work. Basically, I want to add this ... :confirm => ‘Are you sure?’ Here's the line of j...

Javascript custom Array.prototype interfering with for-in loops

I was attempting to extend Javascript's Object type with a function that retrieves all of the property names that are part of that object (basically what PHP's array_keys() function does to associative arrays). Object.prototype.keys = function() { var a = []; for (var property in this) { a.push(property); } return a...

jQuery listview plugin

Is there any ListView widget plugin for jQuery? With resizable columns, sorting helpers, odd-even rows styles etc. Something like ListView class from Ext library but for jQuery (NOT table/grid). UPDATED Have switched to ExtJS so question is not topical anymore. ...

How can I access the sub-items of a <svg:use> tag from javascript?

Hello, I have the following SVG code in a XHTML page <svg:svg> <svg:svg width="450" heigth="450" viewBox="0 0 500 500"> <svg:defs> <svg:g id='mygroup'> <svg:circle id='a' cx="15" cy="15" r='15' fill="green" fill-opacity="0.3"/> <svg:line id='b' x1="15" y1="15" x2="15" y2="0" style="stroke: black;" /...

How to create Google Wave-like scrollbars?

How can I make the scrollbars like in Google Wave? They save a lot of space and look nice.I would like to put the scrollbars on a div like how google wave does it. ...

using hash value in photo gallery

I trying to create a navigation for my photogallery using hash values When I click on the "Next" link, I get value of the hash and then post it to the another backend php script using jquery .get api and also set the new hash value for that link. Everything works fine but the hash doesn't update itself with every click. It usually takes...

How to do a USER NAME & PASSWORD protection in a web site before it is loading

Hi all How can we able to protect a site using USERNAME and PASSWORD after we entering the URL and the site is before loading For ex: http://www.buildyourownbouquet.com/ I need exactly what it looks like... Thanks in Advance Fero ...

Dynamically Generated Select Menus Not Holding State in Edit View

I'm following Railscast 88 to create a dynamic dependent dropdown menu. http://railscasts.com/episodes/88-dynamic-select-menus I'm rendering these dropdowns inside a partial that I'm using in a multi-model form. The form I'm using follows the Advanced Rails Recipes process by Ryan Bates. Because I'm rendering the dropdown inside a ...

Javascript replace doesn't work when it should.

var src = "http://blah.com/SOMETHING.jpg"; src.replace(/.*([A-Z])\.jpg$/g, "X"); at this point, shouldn't src be: http://blah.com/SOMETHINX.jpg If I use match() with the same regular expression, it says it matched. Regex Coach also shows a match on the character "G". ...

Removing page load 'glitch' while jQuery executes

Users in my site are seeing a half-second glitch on each page before any jQuery code executes. This code manipulates the page so you can visibly see elements move in one big chunk, making the user experience feel clunky. I'd prefer the page not to display at all until the JavaScript has run. I'm using jQuery provided by the Google API i...

Is using absolute paths for images/scripts a good idea?

Hi, I have a website which I am updating the URLs for i.e. rewriting to be more SEO friendly. By doing this, it has broken a lot of the links to scripts/images on the various pages. The only way around this (from what I can tell) is to use the absolute path to the scripts/images on the pages. Now unless I am mistaken (or missing someth...

JavaScript on the Calendar

<td class="text">&nbsp;<font color='red'>*</font>Date 1</td> <td nowrap title=""> <Input name="EFF_DATE" class="textrt" maxlength="10" size="25" tabindex="14" value="<%=lStrEFF_DATE%>" <%if (lStrINS_IND.equals("EASC")) { %> readonly <% } %> onfocus="if(lVarEffDateFlag != 0) lVarTempValEffDat...

Creating a custom slider using jQuery UI

I am trying to create a custom slider with two handles using jQuery UI. The problem is that the right handle is moving out of the container. I know the problem, the reason being the fact that the handles are positioned using the left CSS property and since the width of the handles is more than one pixel, the right handle moves out of th...

Wrong results in JavaScript table

Hi, I'm trying to create a matrix for 12-tone music. The numbers between 0-11 show the intervals between pitches. My script shows the matrix correctly as it runs initially with the page; but when we do another calculation with the button, it goes messy, even with the same pitch set. Here is my script: var exist = 0; function ex...

How to detect if the browser supports a language?

Hi, I am building a multilingual website. Is it possible to check if a particular language is installed/supported on the user's machine using PHP or Javascript? I want to detect this and display a message to the user if the language is not supported/installed. Thanks, Mark. ...

how to change the value in the text box to current date depending up on value selected in the dropdown box in javascript

hi I have a two boxes, a 'parent' select box and a 'child' text box. how can i change values that are inside the 'child' text box to current date, depend on what is selected in the 'parent' select box. ...

how to get current date in javascript

how to get current date in java script ...