javascript

Page Performance in IE7 with a large page

Ok so I'm writing a failry complex ASP.NET page that has quite a bit of javascript related to it. The problem is the page has alot going on with it but the browser just acts unresponsive alot of the time and lags while the javascript seems to perform fine. In this page, I send down a array list of available items for the user to select...

How to get the css of a javascript container and all objects within it in javascript or jquery

Some elements in my page are rendered through php code. Sometimes, on link clicks that redirect to a page in the same site, I want to insert html elements like div, span etc through javascript in their respective places. My main question is: how do I insert the elements in the appropriate place, and apply the same css styles to them as t...

How to implement the OO in Javascript using prototype framework?

please give the example to me. I want a class, which is a abstract class name "Person" , and two abstract class named "Male" and "Female", which extends "Person", and two concrete class named "Young man" which extends "Male" and "Young woman" which extends "Female". Also, I need a multiple inherited class which called "Unknown", and it ...

Can't find my functions?

Hi! I've been trying to find out what's going on with my page for more than an hour.. What I'm trying to do here is to call a javascript function when the page loads, but for some reason it says "object required" then its pointing to my onload event in the body tag. This is what I have.. <head id="Head1" runat="server"> <!-- JAVAS...

Accessing value set inside onSuccess function in Prototype

Hi All, I am using Ajax with Prototype library. Here is my function that calls the Ajax function. function Testfn() { var DateExists = ''; new Ajax.Request('testurl',{ method: 'post', parameters: {param1:"A", param2:"B", param3:"C"}, onSuccess: function(response){ //DateExists = respons...

How do I make a collapsible menu in javascript?

Hi all, how do I made an Expanding and collapsiable menu in java script where clicking on one menu will expand the children inside that and collapse other expanded menu? ...

jQuery Week Selector

I'm looking for an easy way to select an entire week (Sunday to Saturday). Initial searching for some sort of jQuery control has turned up empty. Does anyone have any recommendations of some? jQuery UI Themeroller enabled is a plus. ...

Why we use prototype.js with scriptaculous.js ... Whats the main reason ?

Why would we want to use prototype.js with scriptaculous.js? What's the main reason? When should we require that both libraries be include and when shouldn't we? ...

Stylistic Help - jQuery regex parsing

I've written some jQuery for parsing an id out of a link's href. It works, but I'm wondering if there's a cleaner, more idiomatic jQuery way of doing it: <a class="edit_tags" href="/image/edit_tags/id/2">Edit Tags</a> <script type="text/javascript" charset="utf-8"> $('.edit_tags').click(function(event) { event.preventDefault(); ...

IE Times-out Active Javascript Nav Tab

HI , I have a Javascript based drop drown menu , When I am active on the index page for example IE shows the Active tab in a different color which is correct but once I have over another menu field the active nav it lost and hovers over the moused over selection. Does any one know a fix for this ? It is in the latest IE were the bu...

REST Web Service - Website authentication

I have been working on a service that allows registered users to store data and retrieve it using an JavaScript XML Request. Basically, my service has one part that receives that product details and one part that returns them as XML on request. What I am trying to do is prevent people from accessing other users product details. So if on...

How do I select an option using prototype

Say I have a HTML form containing this select element: <select name="mySelect" id="mySelect"> <option value="1" id="option1">1</option> <option value="2" id="option2">2</option> </select> How can I use prototype to select one of the option elements? The methods listed in the API reference of Form.Element don't seem to hel...

How to check if a text variable is contained within another variable.

Hi, just wondering how I can check to see if a text variable is contained within another variable. like var A = "J"; var B = "another J"; something like :contains but for variables. thanks ...

How can I render Ruby code in javascript?

I have a javascript part in my view, that I want to modify through locals I have defined in a helper. <script type="text/javascript"> var store = new Ext.data.JsonStore({ url: '/admin/administration/users/grid_data.json', root: 'users', fields: [ <%- for field in fields do -%> {name: '<%= field[:data_index] -%>'}, <%- end...

How do I draw curved lines on an HTML page using JavaScript?

Is it possible to draw curved lines in an HTML page (normally across cells in a table) using JavaScript (for web graph control)? ...

Does anyone have a copy of appelsiini 'LazyLoader' (javascript file)?

Normally located on this website: http://www.appelsiini.net/projects/lazyload But the site is down... Or does anyone know of another location to download it? :( ...

Remove submit.x and submit.y but retain other values in URL

With my PHP form, I want to pass one value to the URL, but remove submit.x and submit.y. Here's my form: <form action="booking.php" method="get"> <input type="image" value="access" class="rollbtn" src="../images/book-btn.gif" alt="Book" name="submit" /> </form> I want the URL to display booking.php?submit=access - but omit the x a...

JavaScript - Getting a name of an element in associative array

I have a JavaScript object that is treated as an associative array. Let's call it "fields". It has several elements, e.g.: fields['element1'] = ... fields['element2'] = ... fields['element3'] = ... Given fields[0], is it possible to obtain the name of the property (which is "element1") instead of its value? ...

How to improve this code using $(this) in jQuery?

I have the following jQuery function (simplified): function doSomething(el, str) { el.find('.class').text(str)); } Don't worry about the .text() part, in reality I'm doing something a bit more complicated than that... But since that's irrelevant to my question, I'm just using .text() here as a simple example. The problem is, everyti...

Converting json results to a date in javascipt

I have the following result from a $getJSON call from JavaScript. How do I convert the start property to a proper date in JavaScript? [ {"id":1,"start":"\/Date(1238540400000)\/"}, {"id":2,"start":"\/Date(1238626800000)\/"} ] Thanks! ...