javascript

Retrieving an array key (non-associative) w/ limited information

How can I access the key of a non-associate array? Here's my scenario, I have an array of objects (in this case, they are coordinates): coords[0] = {x: 37.543524, y: -56.65474} coords[1] = {x: 35.041292, y: -76.03135} //etc.. I'm using a jQuery templating plugin to print out the results: $('#repeater').tmpl(coords).appendTo('body')...

ASP.NET & JavaScript: Get tree view checked item value.

Hi all, How to obtain value of selected node of asp.net treeview from javascript? I have tree: <asp:TreeView ID="dtDivisions" runat="server" onclick="OnDivisionChecked(event);" ShowCheckBoxes="All" ShowLines="true"> </asp:TreeView> I fill it using next method: private static void BindTreeViewNode(TreeView control, TreeNode parentNo...

What are strategies for AJAX apps to degrade gracefully when JS is turned off?

What general guidelines should I follow to degrade a JS-based web application gracefully? Are there such guidelines? Are there any public pages that make for good / bad examples? Are there any common pitfalls? ...

Javascript - Replace implementations?

Hi. I have to check a string client side. If it contain only "\" (1, 2, or 1000 time) i need to refuse it. Code (with some of your suggestion that unfortunatly dont work): value.replace(/\\/g, ''); if(value=="") alert("NO"); else alert("YES"); so : value="\" = NO value="\hello \people" = YES value="\\\\hello \\people" = YES value="he...

jQuery select img with src

Hey Guys (and Ladies) I want to select an image (with jQuery) by the src attribute. The Image is inside an ul and a collection of div's. The id of the ul is "sortable". Here is my HTML: <ul id="sortable"> <li id="pic_0"> <div class="sortEleWrapper"> <div class="imgWrapper"> <img src="/test1.jpg"> </div> ...

jquery click handler and Oriented object programming

Hi, I have a method in a class and into this method i have a handler for a click event in a div element: function MyClass(container) { this.Container=container; this.PrepareHandlers = function() { $('#Div1').click(function() { alert(this.Container); }); }; } But since im into the handler, ...

How to re-index select box along with hidden fields

I'm struggling to figure out how to re-index (?) a series of hidden fields with jQuery/Javascript. The sample code below is generated each time a user clicks a create button. The numerical value applied to the hidden fields within tier[] is the index of an option selected from a drop-down. The problem I have is every block of code (exce...

Using a html dropdown list to get the correct display text by value

I have some html that creates a dropdown list. The list has text values and text that is displayed to the user. I save some XML based on the “values” the user selects. At some other point in time I need to parse the XML and display the original text but not in the original list. At this point I only have the “value” from the list and not...

CSS/javascript: how do I hide the vertical scroll bar?

I am trying to use jQuery to handle the scroling, so I want to get rid of the browser's scroll bar... how do I do that? ...

Dojo EnhancedGrid nested sorting not working

I am trying to create an Enhanced Grid with nested sorting functionality in Dojo but when I go to add the nested sorting functionality via the plugins the grid no longer works (shows up) in the page. My enhanced grid creation code is as follows: dojo.require("dojox.grid.EnhancedGrid"); dojo.require("dojox.grid.enhanced.plugins.NestedSo...

creating a box with an image

I'd like to take an image and turn the corners over to make a box (like a canvas painting) i have gd library, imagemagick installed on the server and imagick php extension installed. is it possible? any help appreciated ...

UIWebView stringByEvaluatingJavaScriptFromString woes.

I have the following code in a view controller. "pageDisplay" is a UIWebView. When I run the app in simulator, the HTML page comes up as it appears before the JS runs. The element with id "myHeader", an <h1> tag, is unchanged. -(void) loadPageToView:(int)pageNumber{ NSString *path = [[NSBundle mainBundle] pathForResource:[NSString s...

IE7 Selectbox options disable

I have an avaliable list of selectbox and I can't change the options. In Selectbox there are some disabled options but IE7 does not pay attention to the disabled property ;) Which will be the best way to controll disabled options? Thanks ...

jquery slot machine tabs Urls Problem with firefox browser

hello , i use this jquery tabs plugin : http://css-tricks.com/slot-machine-tabs/ it's work very good .. but i have problem with the columns contents .. the problem is that the a urls don't work in firefox .. firefox see urls inside it as normal text . not as urls , it's be not clickable .. so i don't know what is the cause of this pro...

How do I make image slideshows with a fold effect?

Back in 2000 I had a js that let me get a very nice homepage: one picture: <pic src=x> and somehow the js changed the main picture every a predefined time period. (there was a pictures pool that was loaded at pageload) I can find such scripts now but cannot find one with fold effect (like folding a page in a book) The closet I got w...

Javascript Thousand Separator / string format

Is there any function in Javascript for formatting number and strings ? I am looking for a way for thousand separator for string or numbers... (Like String.Format In c#) ...

top.opener.location.reload(true) not refreshing parent page on IE....

Hello all, I have two pages, The parent and from this page I am using: window.open('OrderDetailsFull.aspx?ObjectID=' + ObjectID[1] , "TableDetails","status=0 , toolbar=0 , location=no , menubar=0 , scrollbars=yes , height=600px , width=800px"); to open a new window and manipulate data over there. When i finish what i am doing i nee...

Should I encapsulate blocks of functionality in anonymous JavaScript functions?

My intuition is that it's a good idea to encapsulate blocks of code in anonymous functions like this: (function() { var aVar; aVar.func = function() { alert('ronk'); }; aVar.mem = 5; })(); Because I'm not going to need aVar again, so I assume that the garbage collector will then delete aVar when it goes out of scope. Is this rig...

How do i set a height on a div using javascript

I have a div div id='srch' that has a computed height of 7000px how do i set the height of the another div to the same on window.load div id='set_me' ...

how to show the popup message on Exit button

Hello Friends, I have a button something like this what should I do? <input type="button" value="Exit" onclick="JavaScript:window.location.href='../index'"/> On Exit I am going to Other view.. On click on Exit I need to display popup window saying Are you sure you want to Exit? with Ok and Cancel buttons anybody tell me out to do ...