javascript

How to return id of a submitted form using Prototype?

I have a page that has several ajax submission forms. Each form has a dynamic id assigned to it when it's written to the page. Does anyone know if there is an easy way to return the id of the form that is being submitted? I'm basically looking to click "submit" and alert the id of the submitted form. From there I can use it in the ajax o...

[jqueryui] Sorttable ul li get order

Hello, My html is like this <ul> <li>...</li> <li> <ul> <li>...</li> </ul> </li> </ul> This is just a example, a ul can contain many li but the max depth is ul li ul like in example I am using JqueryUI Sortable to sort this li I want to get the sort order of the li to store it in database so that use...

Hide list on blur

Hi, I have a list showing up when i click on button, the problem is that i want to hide the list whenever it loses focus i.e. user clicks anywhere on a page, but not on that list. How can i do this? Also, you can see how it should look at last.fm, where's list of profile settings (li.profileItem). (ul.del li ul by default is display:none...

Using nsINavHistoryObserver to create events for a firefox extension

I am trying to make a firefox extension which looks at all the new pages that a user views and look at the URL. I was looking at the nsINavHistoryObserver interface and was interested in the onVisit function. Is there a way to create an event listener that can listen to whenever the onVisit function is called? Thanks ...

JQuery parameter serialization without the bracket mess

I'm using JQuery to make a JSON request back to the server and it seems that it's parameter serialization is hard-coded to what PHP expects instead of being generic in nature. Basically I have an object that looks like this: { foo: 1, bar : [1, 3, 5] } And it serializes it to: foo=1&bar[]=1&bar[]=3&bar[]=5 Is there anyway t...

Iterating thorough JSON with jQuery/Javascript

I am trying to fill a table with JSON data. When I run the following script I get only the last entry of 10. I must have to do some sort of .append() or something. I've tried to put this in but it just returns nothing. $(function() { $('#ReportedIssue').change(function() { $.getJSON('/CurReport/GetUpdatedTableResults', function...

How to URL encode this so I can pass it to Facebook Share?

This is the URL I want to share: http://mydomain.com/#url=http://stackoverflow.com Inside my site, I do this in Django so that everything will work: http://mydomain.com/#url={{external|urlencode}} However, when I pass it to Facebook Share, everything gets messed up. http://www.facebook.com/sharer.php?u=&lt;url to share>&t=<title o...

By passing div id, can i change target of text replacement?

I am using the code below to replace text inside a div. But I need to loop through a specific div, instead of everything on the page, that is the div's text nodes... I just do not understand how to refer to the div in the code below. (function (parent) { var childs = parent.childNodes; // if there are children to this if (childs &...

Remove querystring from URL

What is an easy way to remove the querystring from a Path in Javascript? I have seen a plugin for Jquery that uses window.location.search. I can not do that: The URL in my case is a variable that is set from AJAX. var testURL = '/Products/List?SortDirection=dsc&Sort=price&Page=3&Page2=3&SortOrder=dsc' ...

IE7 - visited links revert to unvisted after page refresh

Hello, A number of our users have just upgraded from IE6 to IE7. the upgreaded users are reporting an issue with visited links reverting to their unvisited color after a page refresh. This only happens to links that are using javascript instead of a hard coded URL: <script lang="JavaScript"> <!-- function LoadGoogle() { var LoadGo...

Refresh table after using jQuery .append()

The following code gets a JSON object and then spits its contents out into a <table>. The first time I do it I get my JSON content just fine. However, when I refresh, the refreshed data is stuck onto the bottom of my table. How do I refresh the data to show the new data only? I tried using .remove() but there was an obvious deleting ...

Can I write this JQuery statement cleaner?

Hello, So I have the following: var box = $(".MyCheckBox"); if (box[0].checked) { // Do something } else { // Do something else } Is there a better way of doing this using filters or something? I know I can go: $(".MyCheckBox") .filter(function(index) { return this.checked; }) .each(function() { ...

Opening new window in HTML for target="_blank"

<a href="facebook.com/sharer" target="_blank" >Share this</a> How do I make this a certain width and height, in a new window, when the user clicks on it? In firefox, the current code only opens up a new tab (not a new window) ...

Html is rendered event

I'm appending some code to my page using jQuery AJAX calls. This code is a mix of html and javascript. But I want javascript to be executed only when html part is ready. But what event is raised when appended html is rendered? Here is an example: <table id="sampleTable"> ... </table> <script> // this code should be executed only ...

get average color of image via javascript

Not sure this is possible, but Looking to write a script that would return the average hex or rgb value for an image. I know it can be done in AS but looking to do it in JavaScript. ...

Hide table rows if Cookie is there

Based on my previous question here and here, I found that I can set a cookie with javascript. I want to combine it with jquery to have a cookie state set for toggled table rows. I want to keep the hidden rows hidden upon reload. Here is what I have achieved so far: // Load cookies if any if(readCookie('togState')) { $('table#...

how do I assign a variable to a returned response in jQuery

I wanted to assign a returned value (just text) to a variable in jQuery. I wrote this: var hm=22; $.ajax({ type: "GET", url: "ajax_check_match.php", dataType: "text", success:callback }); function callback(data, status) { //...

Does Validator.SetFocusOnError work without a postback?

I have an ASP.net page with a RegexValidator. The RegexValidator successfully displays my validation error text when a user types a value out of range and navigates (tabs) off of the control. At that point, it doesn't set the focus to that control, even though I have SetFocusOnError="true". The focus does appear to be set when I click...

[jquery] Appending to Second Last element

Hello, This is the final output My HTML <li id='$id'>TEXT <ul class='indent'> <li id='$id'>TEXT</li> <li id='$id'>TEXT</li> <li class='formContainer'> FORM </li> </ul> </li> I want to append a li between form after all other li So in this example new li will be appended between Test141 APPEND Input B...

Javascript errors from Google Adsense

Hey there, On several of my adsense running sites, I have been getting the following errors: Unable to post message to [http://]googleads.g.doubleclick.net. Recipient has origin http://www.anekdotz.com. Unsafe JavaScript attempt to access frame with URL [http://]www.anekdotz.com/ from frame with URL [http://]googleads.g.doubleclick.ne...