javascript

POST data in JSON format with JAVASCRIPT

Hello, I have some data that I need converted to JSON format and then POSTed with a Javascript function. <body onload="javascript:document.myform.submit()"> <form action="https://www.test.net/Services/RegistrationService.svc/InviteNewContact" method="post" name="myform"> <input name="firstName" value="harry" /> <input name="lastName" va...

In Greasemonkey/javascript, how can I handle new elements added to page?

I have written a Greasemonkey script which manipulates the contents of certain elements with the following selector: $("span.relativetime").each(function() { $(this).html("TEST"); }); However, sometimes matching elements are added to the page through AJAX, and I don't know how to handle those new elements. I have tried this, but it d...

div or iframe over an applet

Hi guys, I want to create a custom video control, I mean over the video itself, with issues like double click on some x and y coordinates of the video to zoom In, but I can't get this result because the real player plugin API is not that flexible, then I Tried to create a transparent layer to handle those events and I can't achieve that ...

What exactly can cause an "HIERARCHY_REQUEST_ERR: DOM Exception 3"-Error?

And how exactly does it relate to jquery? I know the library uses native javascript functions internally, but what exactly is it trying to do whenever such a problem appears? Thx for any response in advance. ...

Why is my ASP.NET page injecting this WebResource.axd Javascript file?

When I view source on my ASP.NET page I get the following snippet: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTA...

Slow Canvas Element

Hi Using the Canvas element, I draw a line from one element to another element Another element is draggable, and when dragging the element the line follows the draggable element. My problem is that the rendering apears slow (Fx 3.5 on a Mac PowerBook) I think I have seen much better performance in Canvas before Anyone with Canvas exp...

How to get character coordinate in a text block?

In a block of a monospace text, is there a javascript snippet or JQuery plugin that gets coordinate (row & col of text, not pageX & pageY) of the character under mouse cursor and highlight the character? ...

Problems with replacing a static id with variable

I have a script that loads info from external XML file and inserts it into the HTML page on click. Here's the code of this script: var xmlhttp; function loadXMLDoc(url,target) { xmlhttp = null; if (window.XMLHttpRequest) { // code for all new browsers xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for I...

Browsing a string in IE

I am trying to browse a string using javascript. Here I am only displaying the value of each characters in the string: var value ="123#sometest"; for(var i=0; i< value.length;i++){ alert(value[i]); } This works fine in Firefox, but in IE (6 and 7), this breaks. value exists, i exists, but value[i] is undefined. Any idea why and how...

One-to-many Associations Empty Columns Issue (Ext on Rails)

I'm playing with rewriting part of a web application in Rails + Ext. However, I'm having trouble getting an associated models' name to display in the grid view. I've been able to successfully convert several models and arrange the views nicely using tabs and Ext's layout helpers. However, I'm in the middle of setting up an association ...

Best approach avoid naming conflicts for javascript functions in separate .js files?

Is there a preferred approach to isolating functions in a .js file from potential conflicts with other .js files on a page due to similar names? For example if you have a function function AddTag(){} in Core.js and then there is a function AddTag(){} in Orders.js they would conflict. How would you best structure your .js files an...

JavaScript stripper: remove functions/objects that are not used in a web page

All of my web pages use a JavaScript library, to improve the performance of my web page, I'd remove all the unnecessary functions/objects from the library for each page according to what's needed for those individual pages. I'm looking for a tool that can do the intelligent stripping automatically. Or in the opposite direction. it will...

jQuery: Getting the two last list items?

I want to apply a special class to the two last list items in an unordered list with jQuery. Like this: <ul> <li>Lorem</li> <li>ipsum</li> <li>dolor</li> <li class="special">sit</li> <li class="special">amet</li> </ul> How to? Should I use :eq somehow? Thanks in advance Pontus ...

getJSON fails, JSON validates

I have a getJSON call which is inexplicably failing. The idea is, you click to submit a comment, a URL gets hit which determines if the comment is OK or has naughty words in it. The response is given in JSON form. Here's the paired down JS that generates the call. The comment and the URL are already on the page, it grabs them and hits t...

JavaScript extractor: extract functions/objects that are really used in a web page from a library

This is a twin question to the following: http://stackoverflow.com/questions/1257225/javascript-stripper-remove-functions-objects-that-are-not-used-in-a-web-page To maximize my chance of getting my problem solved, I'm asking the question in opposite manner: All of my web pages use a JavaScript library, to improve the performance of my...

JavaScript: Know when an image is fully loaded

If I have a beacon: <img src="http://example.com/beacon" /> I want a method to be called once the beacon request finishes. Something like: <script> $("img.beacon").load(function() { // do stuff knowing the beacon is done }); </script> Is it possible? Is it in jQuery? ...

Using facebook connect with Jquery

Is it possible to use Facebook connect with Jquery? I've found some old posts saying it isn't possible, but I'm not sure how things currently are. I've found that the Facebook connect code is mostly using Fb as the namespace, while jquery uses the $ sign, so may be it is possible? ...

JavaScript persistent variable

Hi, I have created a scroll div which works and is fine. However, my boss now wants to give the client the option of turning of the scrolling feature. I have done this with a simple boolean variable, the problem being that the results page, which has the scrolling feature, has several pages and if the user clicks on to the next page t...

One JS app Overwriting Another.

Forgive me as I ask what is wrong with my JS. I am really new to all of this. I've been redesigning my portfolio site and have hit a wall trying to put two different JavaScript applications together. I want my site to be just one page and use JS to view all the content. In order to do this I am using two different Jquery apps. This a...

Javascript Distributed Computing

Why aren't there any Javascript distributed computing frameworks / projects? The idea seems absolutely awesome to me because: The Client is the Browser Iteration can be done with AJAX Webmasters could help projects by linking the respective Javascript Millions or even billions of users would help DC projects without even noticing Ple...