javascript

What Jquery Plugin or Extension could I use to construct a query string?

At this moment we construct our search query in our website with java script. We have an input box for keyword and another input box for name and so on. If a user enters keyword: test the query looks like: http://oursite.com/Search?keyword=test if they enter keyword: test and name: john the string looks like: http://oursite.com/Sear...

Why is .val() not a function?

I have a dynamic form where the user provides a name and description: <label>Name</label><br /> <input type="text" name="name[]" maxlength="255" /><br /> <label>Description</label><br /> <textarea name="desc[]"></textarea><br /> I am trying to validate the form with Javascript to ensure that if the name is specified, then a descripti...

Javascript not working in Safari in Mac OSX

I have a payment page where a customer is entering their credit card details. I have removed all of the non-relevant sections. What's weird is that my front-end validation works fine on FF, IE, and Safari for windows. It only is failing on Safari in Mac OSX. Specific user agent strings that have had issues: Mozilla/5.0 (Macintosh;...

Removing an element from DOM

I use this method to escape strings of HTML code on client side: function escapeHTML(str) { var div = document.createElement('div'); var text = document.createTextNode(str); div.appendChild(text); return div.innerHTML; }; I am a bit concerned about memory leaks because I'm creating DOM element and not destroying it. The p...

Prototype equivalent for jQuery live function

I need to bind event listener to all dynamicaly created elements by given css selector. In jQuery, that would be $(".foo").live("click", function(e) { // bar }); Is there any equivalent in Prototype for this? ...

contenteditable and non button elements

I can easily do execcommand on a contenteditable selection if using a button. However using any other element fails. http://jsbin.com/atike/edit Why is this and how can I make it work using a div element. Thanks. ...

How can I get an object's absolute position on the page in Javascript?

I want to get an object's absolute x,y position on the page in Javascript. How can I do this? I tried obj.offsetTop and obj.offsetLeft, but those only give the position relative to the parent element. I guess I could loop through and add the parent's offset, and its parent's offset, and so on until I get to the object with no parent, ...

What is in your JavaScript toolchain?

I am looking to start writing a sophisticated application in JavaScript to run on the web. I've written little bits of throwaway code in JavaScript before, using the DOM directly and a little bit of jQuery. But this is the first time I'm looking to write a full-fledged application to run in the browser. So, I'm wondering what toolchains...

Alternatives of JSON.stringify() in JavaScript

In JavaScript, what are the alternatives of JSON.stringify() for browsers that do not have native JSON support? Thanks ...

Which javascript interpreter is the easiest to embedd in a C application?

There are a few available and i want to support many platforms so i guess V8 isn't that good unless someone has written an interpreter patch for it. ...

jquery kwicks issue

Hi there, I've been working on my problem for the past few hours and am at the end of my rope. I need help. I have a staging page where I tested the code and verfied that it works, but on the live page, the code refuses to budge. I can't figure out why kwicks jq seems to be ignoring the html on the jujumamablog.com header. <-- this i...

Recommended way to map between JavaScript sparse array and C# (sparse)array?

Hi, I am trying to map a JavaScript sparse array to a C# representation. What is the recommended way of doing this? It am considering using a dictionary containing the list of oridinals that contained a value in the original array. Any other ideas? thanks! ...

Java script alert msg in code behind Asp.net 3.5

Hi, How to use Java script alert msg in code behind? This message will be display after save the data. Here is my code, enter code here Protected Sub Add_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Add.Click 'add new class Dim DbClassMst = New ClassMst() Dim dsClass As DataSet Dim status As Int...

It is possible to set size of images in imagearray of javascript?

Hi, It is possible to set height and width of images in imagearray of javascript? imagearray: [ ["http://i26.tinypic.com/11l7ls0.jpg", "", "", "My Text"], ["http://i29.tinypic.com/xp3hns.jpg", "", "", "My Text"], ["http://i30.tinypic.com/531q3n.jpg"], ["http://i31.tinypic.com/119w28m.jpg", "", "", "My Text"] ], H...

What is currently the best HTML/CSS/Javascript configuration?

I'm getting more into jQuery and so have set up a HTML/Javascript/CSS base site which I use for all my tests. Since these tests will eventually turn into PHP and ASP.NET MVC websites, I want to use this opportunity to get the basics down right again for modern browsers and web standards before building the scripting languages on top of ...

Using non persistent Http Cookies to deliver out of band data to the browser

Imagine that your web application maintains a hit counter for one or multiple pages and that it also aggressively caches those pages for anonymous visitors. This poses the problem that at least the hitcount would be out of date for those visitors because although the hitcounter is accurately maintained on the server even for those visito...

Show certain InfoWindow in Google Map API V3

Hello. I wrote the following code to display markers. There are 2 buttons which show Next or Previous Infowindow for markers. But problem is that InfoWindows are not shown using google.maps.event.trigger Can someone help me with this problem. Thank you. Here is code: <html> <head> <meta name="viewport" content="initial-scale=1.0, user-s...

javascript showdown, markdown not parsing correctly

I have a little confusing problem. I have two files, both that run showdown however it seems that only one file parses correctly. Here's the deal. File 1 . Is run through php and ajax File 2 . Is grabbed via an ajax request, the file the processes the ajax request contains this code. Here is the ajax as you can see, the jquery that...

KeyDown event gets invoked twice

I've got this Prototype code to detect Enter pressing in textarea. document.observe('keydown', function(e, el) { if ((e.keyCode == 13) && (el = e.findElement('.chattext'))) { e.stop(); // foo bar } } And html <textarea id="chattext_17" class="chattext" cols="20" rows="3"></textarea> But the problem is, that ...

What does document.domain = document.domain do?

The client-side JS component of Orbited (a Comet server), requires that if the server is running on a different domain or port to the JS itself, you must execute document.domain = document.domain; before any other JS is loaded. (See the documentation.) What does this do? It looks like a NOOP! (I've checked and it is in fact necess...