javascript

Is it possible to export a value of an variable from one javascript to an other?

Hi All I have made a Web page using jquery and php where all files are used in a modular style. Now I have two JavaScript files which must communicate with each other. One Script generates a variable (*id_menu_bar*) which contains a number. I want that this variable gets transported to the second JavaScript and is used there. How do I ...

JQuery .each() callback function doesn't run on each iteration/loop

Here's what should happen. 1. Get the rel attribute of the clicked link 2. For every div with class 'entry': (i)Get its 'left' position (ii) Calculate its outer height (iii)Loop through all instances of 'a.tag_filter'. If it finds the same string in the 'rel' as the one oringinally clicked on then add 1 to 'V' and break out o...

Append Text Javascript

I have a span in a long section of HTML; i have done Hit Highlighting of terms by finding my text and wrapping it with a span which makes the text obvious to the user <span id="MySpan" style="background-color:yellow">Some Text</span> The problem I have is that adding the formatting was easy if they change the search terms i need to re...

How to access element id and other attributes using jQuery?

I have JavaScript method which acts when a particular class (mcb) of forms are submitted: function BindCloseMessage() { $(".mcb").submit(function(event) { alert("closing..."); //Here I want to get the id of form event.preventDefault(); }); } In place of alert call, I need to access the id of form whose submit i...

concat (in javascript) not working for associative arrays..

Hi I have problem concatenating two associative arrays in javascript. below the sample code var firstArray = new Array(); firstArray.c1 = "sam"; firstArray.c2 = "kam"; var secArray = new Array(); secArray.c3 = "sam"; secArray.c4 = "kam"; var res = firstArray.concat(secArray); is this a known limitation?? whats the best way ...

How to post ASP.NET MVC Ajax form using JavaScript rather than submit button

I have a simple form created using Ajax.BeginForm: <% using (Ajax.BeginForm("Update", "Description", new { id = Model.Id }, new AjaxOptions { UpdateTargetId = "DescriptionDiv", HttpMethod = "post" },new {id ='AjaxForm' })) {%> Description: <%= Html.TextBox("Description", Model.Description) %><br /> <input ty...

Delete specific class in page (jQuery)

How can i delete all classes "green" in the page using jQuery? I don't know what selector it has. find('.green').removeClass('green') does not work. ...

Is it OK to add your own attributes to HTML elements?

Possible Duplicates: Custom attributes - Yay or nay? Non-Standard Attributes on HTML Tags. Good Thing? Bad Thing? Your Thoughts? In current learning project I am working on, I need to add an attribute whose value will be a number. At first I thought of using "id" for this purpose but an answer revealed that it is not good to d...

good parser for key=value CRLF file

Any sample code how to make hashmap or similar list from key=value CRLF key2=value2 CRLF ...

XMLHttpRequest to another domain

What can be done to access remote domain most easily to read data with XML HTTP REQUEST? ...

ASP.NET postback with JavaScript

I have several small divs which utilizing jQuery draggable. These divs are placed in an update panel, and on dragstop I use the _doPostBack() JavaScript function. where i extract necessary information from the pages form. My problem is that when i call this function the whole page is re-loaded but i only want the update panel to be re-...

converting XMLHttpRequest to JSONP

help, I need to change this code to support remote domain access: document.write(url); var http = getHTTPObject(); http.open("GET", url, true); http.onreadystatechange = function() { if (http.readyState == 4) { parseData(http.responseText); } } http.send(null); ...

remove value from comma separated values string

I have a csv string like this "1,2,3" and want to be able to remove a desired value from it. For example if I want to remove the value: 2, the output string should be the following: "1,3" I'm using the following code but seems to be ineffective. var values = selectedvalues.split(","); if (values.length > 0) { ...

C# (.NET) handling Javascript Array/Serialization

I'm using tableDnD to re-order table rows, and then serialize them using "$.tableDnD.serialize()" I want to send this to C# for processing, what's the best of doing so? The below is an example of the serialization pages[]=&pages[]=21&pages[]=23&pages[]=34&pages[]=37&pages[]=40&pages[]=43&pages[]=46&pages[]=49&pages[]=31&pages[]=50&pag...

How debug Javascript with IE 8

How can we debug JavaScript with IE 8 ? The JavaScript debbuging with Visual Studio doesn't work after an update to IE 8. ...

What is JSON-P & how do you pronounce it?

Related question: Explanation and usage of JSONP. I know what JSON is but what is JSON-P? How do you pronounce JSON-P? ...

Obtaining a referring short URL using a widget.

Hi, I'd like to create a client-side javascript widget on a blog that obtains the shortened URL from which a visitor used to come to the blog. While the widget can get the Referrer, such would only be the referring page URL, not the shortened URL that was placed on the site that had to be clicked. I know shortener sites use either 301 or...

Get parent index with jQuery

<ul class="bullets"> <li><a href="#">item 1</a></li> <li><a href="#">item 2</a></li> <li><a href="#">item 3</a></li> <li><a href="#">item 4</a></li> <li><a href="#">item 5</a></li> </ul> When I click on the <a> element, i'd like to get it's parent <li>'s index number. I'm trying to create a carrousel type function that doesn...

How do I fill a dropdownlist on mouse event with jQuery?

Lets say that I have a drop down list that I want to create "on the fly" when the user interacts with it. For example: the drop down list only has the the option "Attach a file". When the user clicks/interacts on the drop down list, I need for it to generate, at that moment, all the available files they can attach (which depends on o...

Browserless, ant-task-oriented Javascript Unit Testing?

I'm looking for a javascript unit test framework that I can use as part of my automated maven build. This CANNOT use an actual browser, and it MUST be fully browserless. I've tried looking at a few posts on SO, but none seem to meet my needs. Is there such a javascript unit tester? I'm anxious to find out. ...