javascript

Get link value in html document with jQuery?

Hi, Let's say I have a link in a table like: <td class="ms-vb" width="100%"> <a onfocus="OnLink(this)" href="/Lists/Business%20Divisions/DispForm.aspx?ID=2" onclick="GoToLink(this);return false;" target="_self">Train<img src="/_layouts/images/blank.gif" class="ms-hidden" alt="" width="1" border="0" height="1"> </a></td> How can I...

Replace hard coded values in an array with values from another array with JavaScript?

Hi, I have a sharepoint site and want to create a script for links with querystring values that are not hard coded so I can use it on several sites without having to alter it. The HTML is a mess and I can't alter it. I have some charts with links to a page with more details. On the page with charts I have some filters and when a user s...

Are there any web browser plugins that can give access to machine's command line? (for local use)

EDIT: please read the question and why I want to do it before passing judgement on this, I want to develop locally using a web browser as the interface, I KNOW its a security hole, but if there is a way for the end user to disable this security so it can be used locally I want to know, of course this isn't possible under normal circumsta...

Find day difference between two dates (excluding weekend days)

Hi i am using jquery-ui datepicker to select date and date.js to find difference between 2 dates. Right now the problem is I want to exclude weekend days from calculation (saturday and sunday). How should i do that? For example the user select start date (13/8/2010) and end date (16/8/2010). Since 14/8/2010 and 15/8/2010 is in week d...

IE IFrame - stale references

I have 2 iframes on a page, a navigation and a detail. The navigation iframe has paging/searching/etc.. functionality that can cause the detail to refresh with new url parameters. After the detail iframe loads, the navigation iframe needs to perform some dom manipulations on elements it already had in memory. For example: jQuery(searc...

Pass C# ASP.NET array to Javascript array

Does anyone know how to pass a C# ASP.NET array to a Javascript array? Sample code will also be nice. Sorry if I was vague earlier guys. The question is actually quite simple. Let's say for simplicity that in my aspx.cs file I declare: int [] numbers = new int[5]; now I want to pass "numbers" to the client side and use the data in the...

Window beforeunload shows two dialogs

I have this jQuery code; $(function () { $(window).unbind("beforeunload"); $(window).bind("beforeunload", function () { return confirm("Really?"); }); }); When i close my window I get the confirmation request and if I hit "Cancel" I get a second confirmation which says; "Are you sure you want to navigate away from...

Convert lat / lon to pixel locations

I've got a map (Mercator), and the coordinates of the 4 corners of the map. I need to come up with something so I can convert given coordinates to corresponding points on the map. I can't use google or anything of the sort, which is why I'm needing to do this in the first place. The languages I can use are either going to be PHP or ...

ASP.net Custom Multiple control validator javascript issue

I've used the code in this article before to create a custom validator to validate mupltiple controls on a page. Using the "inline method" to hook up the validators just beofre the closing form tag. This time I'm making a user control and want the control to handle the generatio/rendering of the javascript to hook up the validators. The...

Return node text (non-recursive)

Hi, I'd like to return a table cell's node value. The method text() however, goes down the whole DOM tree and returns a string of all nested nodes (the table cell may have text and html included). Once I have extracted the node's string, I'd like to modify it and write it back to the node. The modified text consists of text and html. I...

How to validate an Ajax Form Submit (remote_form_tag) ?

I have an ajax mail form like - form_remote_tag :url=>mails_path,:condition=>"validate_mail()", :html => {:id=>"mailform",:method => :post, :class => 'ajax',:style=>"padding:15px;" } do |form| .gimmespace Naam %br = text_field_tag :name,params[:name],:class=>"title required" .gimmespace Telefoonnumm...

Javascript / jQuery - How do I find the memory leak in my large amount of code?

I've written a lot of code for a website I'm developing and only just now realised it has a memory leak. I noticed Firefox getting rather slow over the day and checked my task manager to find it idling at 600,000 K. Seemed odd and so I killed it/restarted it. Then realised that, while watching the task manager, the more I played around ...

jsonp memory leak

Possible Duplicate: jsonp memory leak So I've recently setup a chrome extension to refresh a page and call a jsonp web service I've written but there is a memory leak. I've searched all of the internet to find solutions and nothing seems to work. I've used the plain jQuery .ajax() call specifying "jsonp", I've used jquery-json...

insert item in javascript array and sort

Hi, Let's say I have an array var test = new Array() the values in test are 3,6,9,11,20 if I then have a variable var id = 5 how can I insert 5 between 3 and 6 in the array? or do I just insert it wherever and then sort the array? Thanks in advance. edit: I have the following code: function gup( filter ) { filter = filter.r...

jsonp memory leak

So I've recently setup a chrome extension to refresh a page and call a jsonp web service I've written but there is a memory leak. I've searched all of the internet to find solutions and nothing seems to work. I've used the plain jQuery .ajax() call specifying "jsonp", I've used jquery-jsonp found at http://code.google.com/p/jquery-jsonp/...

JavaScript get window X/Y position for scroll

I'm hoping to find a way to get the windows position (relative to the total page width/height) so I can use it to force a scroll from one section to another. However, there seems to be a tremendous amount of options when it comes to guessing which object holds the true X/Y for your browser. Which of these do I need to make sure IE 6+, F...

Getting array to .ajax on success

I'm trying to return data as an array to my .ajax function on success so I can do do multiple things, but I can't get to work for anything except a single value. Like return $foo. But when I return $array, the page never loads up. ...

Will inserting the same `<script>` into the DOM twice cause a second request in any browsers?

I've been working on a bit of JavaScript code that, under certain conditions, lazy-loads a couple of different libraries (Clicky Web Analytics and the Sizzle selector engine). This script is downloaded millions of times per day, so performance optimization is a major concern. To date, I've employed a couple of flags like script_loading ...

Validating UK Post Codes using regular expressions.

I want to validate a field with a UK Post Code. What regular expression could be used to validate this field?. (([A-Z]{1,2}[0-9][0-9A-Z]{0,1})\ ([0-9][A-Z]{2}))|(GIR\ 0AA)$ does appear valid because it has the exception GIR 0AA. So, please help me to write an expression without any exception ...

how to disable a ajaxtoolkit CollapsiblePanelExtender from client side?

hello everyone, does anyone know a client side method to disable the CollapsiblePanelExtender? I have get the extender by behaviorId. var extender = $find("behaviorId"); so next what method i can use to disable this extender from client side? Thanks ...