javascript

Compare 2 dates with JavaScript

Hi, can some one suggest a way to compare values of 2 dates greater then, less then and not in the passed using javascript. They values will be coming from text boxes Thanks ...

Regex to strip lat/long from a string

Anyone have a regex to strip lat/long from a string? such as: ID: 39.825 -86.88333 ...

Populating a thickbox via javascript or jQuery

I'm trying to get string data from a web service and populate a thickbox with this data. I feel like this should be the easiest part of the task but so far this is where I'm stuck. Here is the code in question... function AjaxRequestHandler(layerName) { PageMethods.AjaxRequestHandler(layerName, OnSucceeded); } function OnSucceed...

How can I create an empty HTML anchor so the page doesn't "jump up" when I click it?

I'm working on some JQuery to hide/show some content when I click a link. I can create something like: <a href="#" onclick="jquery_stuff" /> But if I click that link while I'm scrolled down on a page, it will jump back up to the top of the page. If I do something like: <a href="" onclick="jquery_stuff" /> The page will reload, whi...

jQuery not working on my host?

I am working on a site, and everything is working in my local environment as well as on a test server I have here and everything works fine. but when I upload it to my host, nothing seems to work!? The Asp.Net javascript validators fire, but any and all of the jquery is not working? I even put in a simple $("#test").html("working");...

Persistent connection using Javascript

Is there a general way to implement part of an application with JavaScript and supplying a persistent connection to a server? I need the server to be able to push data to the client, regardless of the client being behind a firewall. Thanks in advance ...

List of global user defined functions in javascript ?

Is it possible to get a list of the user defined functions in javascript? I'm currently using this but it returns functions which aren't user defined: var functionNames = []; for (var f in window) if (window.hasOwnProperty(f) && typeof window[f] === 'function') { functionNames.push(f); } ...

How do you pass a variable to a Regular Expression JavaScript?

I'd like to create a String.replaceAll() method in JavaScript and I'm thinking that using a RegEx would be most terse way to do it. However, I can't figure out how to pass a variable in to a RegEx. I can do this already which will replace all the instances of "B" with "A". "ABABAB".replace(/B/g, "A"); But I want to do something like...

jQuery and ASP.NET - forcing button click

I have a ASP.NET page which has a form on it. It also has a search form on it. The search is in the top-right of the page, so the button for the search is the first added to the control hierachy. When you're working on the other form and press enter it will click on the search button. I don't want this, I would prefer that when you pres...

Check all radio controls with a specific substring on an ASP.NET form

I'm working on a .NET-powered questionnaire which contains several repeater controls, each row of which contains three radiobuttons. I'm trying to write a simple Javascript function to check all the controls on the page which contain the word "chkGreen" in the control name/id. The page looks something like this: Repeater 1 Description ...

How do I create a new DOM element from an HTML string using built-in DOM methods or prototype

I'm trying to create an element dynamically using an HTML string. Here's a simple example using both prototype and DOM: // HTML string var s = '<li>text</li>'; // DOM var el1 = document.createElement(s); // prototype var el2 = new Element(s); $('mylist').appendChild(el1); $('mylist').appendChild(el2); Both approaches insert an empty ...

jQuery: Set click from array loop.

Hi All, I have a series of divs in a pattern of header/body, where a click on the header will show the body in question. This all happens with .click initialized on page ready... Rather than doing this (which works fine, but is a pain): $('#show_fold_ping').click(function(){ ShowArea('#fold_ping') }); $('#show_fold_http').click(funct...

How do you determine media type in Javascript?

I looked around and didn't see this question asked yet. What's a reliable way in Javascript to determine the media type (e.g. screen, print, handheld) of the page? I've seen references to document.styleSheets[0].media, but I've had no luck using this, either because of browser support issues or because I'm not understanding something. ...

Are there any sites/services/scripts that will reverse JS minification?

I'm looking for a way to input a minified JavaScript file and end up with something readable. I understand that it won't have the original variables, they'll all be single letters, but at least it would have lines breaks and possibly tabs. Is there anything out there? ...

Highlighting columns in a table with jQuery

I have a table and I am highlighting alternate columns in the table using jquery $("table.Table22 tr td:nth-child(even)").css("background","blue"); However I have another <table> inside a <tr> as the last row. How can I avoid highlighting columns of tables that are inside <tr> ? ...

Javascript force open a link in a browser

Hi, Is there a way to do object detection from JavaScript and force open a link in a specific browser? For eg: Open in IE, Open in Firefox TIA Raj ...

How do I pass multiple arguments into a javascript callback function?

Javascript code: function doSomething(v1,v2){ //blah; } function SomeClass(callbackFunction,callbackFuncParameters(*Array*))={ this.callback = callbackFunction; this.method = function(){ this.callback(parameters[0],parameters[1]) // *.* } } var obj = new SomeClass( doSomething, Array('v1text','v2text') ); The proble...

How do I localize the jQuery DatePicker?

I really need a localized dropdown calendar. An English calendar doesn't exactly communicate excellence on a Norwegian website ;-) I have experimented with the jQuery DatePicker, their website says it can be localized, however that doesn't seem to work. I am using ASPNET.MVC, and I really want to stick to one javascript library. In thi...

Velocity and JavaScript

Hi, I have a bit of a problem here: #foreach($image in $command.lessonLearned.images) Image: $image.fileName <input type="submit" onclick="submitForm();setImageToRemove($image.id);setAction('removeImage');" value="REMOVE"/><br/> #end $image.id inside the onclick event is not evaluated as a velocity variable. How do I make it w...

Add a row to a table in Javascript that contains input classes.

Im trying do this basically: var tr = document.createElement("tr"); var td = document.createElement("td"); td.appendChild(document.createTextNode('<input class="param" type="text" name="dummy" value="fred"/>')); tr.appendChild(td); but it just displays the input... as normal text, how do I insert it so that it works as i ...