javascript

How many lines of code will be saved using JQuery instead of straight JavaScript?

Maybe someone more familiar with the topic can help me to simplify or write the question correctly. We are looking for metrics on JQuery or even other JS Frameworks in comparison with the use of straight javascript. I don't beleive in the lines of code metric, never have, but I cannot think on anything else to measure it. Function Poi...

JavaScript on CommandLine

I have a project that needs to create and use COM objects. I found some examples using Javascript on the command-line and it looks like the perfect option for me. They will likely be short scripts (<100 lines) that talk to a COM server and a Postgres database. Does anyone have a better approach? Is there a good tool that can assist w...

What would you suggest for a Javascript MVC framework?

What would you suggest for a Javascript MVC framework? SproutCore JavascriptMVC Junction Something I haven't heard of... ...

Rails `link_to` method posting multiple times

[see later answer for more] I think this is just a simple rails question, and mostly on how i've named my models and reference them in my view. So a little background, I'm using the vote_fu plugin, which I think is great, however I'm having a hard time getting the voting to work from a link as follows: <%= link_to "vote for", current_u...

referencing JS object member without the key

var foo = { "bar": {"blah": 9 } }; Is there a way to get the ["blah"] value of the only member of foo if I don't know the key is "bar"? Can I somehow reference the first member of an object without knowing its key? I'm looking for the equivalent of foo[0]["blah"] if foo were a normal array. In my case, I can't practically iterate...

How to make window.print pop up a print dialog with Preview?

I tried to create a simple HTML page as below <html> <a href="javascript:window.print();">Print this page</a> <div> something something </div> </html> After clicking the "Print this page", the pop-up print dialog is quite simple. There is no preview in the dialog. In Google Calendar, user can print calendar. In...

Floating Bottom Bar jerky when moved

Hi all, I created this sample page with the bottom floating bar http://www.innovie.com/Untitled-3.html The problem is that when I move the scroll bar on the right, the floating bottom bar is moving jerkily although it eventually is at bottom. I tried to fix the jerky movement by either removing the background img for BODY or removing...

Javascript file inclusion in html pages- what happens underneath in the browser?

Hello, I think this may be a browser dependent question- Suppose I have 10 Javascript files and several HTML pages. Suppose HTML pageA needs only JS1.js and JS3.js, similarly HTML pageB needs JS4.js and JS1.js. I want to know what would be effect of including all the 10 javascript files in all HTML pages? Will it directly relate to the ...

Are /regex/ Literals always RegExp Objects?

Basically, my question is about how Javascript handles regex literals. Contrasting with number, string and boolean where literals are primitive data types and corresponding Number, String and Boolean objects exist with seamless type conversion, are regex literals anonymous instances of the RegExp object or is this a case of regex being ...

Determining flash component has loaded.

Hi, I have an HTML page containing a flash file, I need to write code in javascript that would execute once the flash file is loaded. (its actually the code to overide the __flash__removeCallback to solve the famous line:52 bug refer: https://bugs.adobe.com/jira/browse/FP-529) The actual solution for the bug is doing so on window.onUnlo...

iPhone dashcode xmlhttprequest no response

I'm developing an iPhone web app with dashcode. My app runs fine when I browse it with the iphone simulator. When I deploy it to a web-server, I never get a response from XMLHttpRequests. Here's the code I use: function get(feedURL, handler) { var onloadHandler = function() { handler(xmlRequest); }; var xmlRequest = new XMLH...

How to disable browser or element scrollbar, but let scrolling with weel or arrow keys?

I want to hide scrollbars from div element or whole body, but let user scroll it with mouse wheel or arrow keys. How to achieve this with raw javascript or jquery? Any ideas? ...

can anybody help me how to deal this 2 javascript conflict

The First Script that allows me to create a moving clouds and loop after if reaches the end // dvdp - volll - iphone alert var agent=navigator.userAgent.toLowerCase(); var is_iphone = (agent.indexOf('iphone')!=-1); // TJP - volll var stispace=new Array(); var jumpspace=new Array(); var skyspace=new Array; skyspace['dir']=-1; skys...

How can move the code above into the jQuery-plugin

I'm writing a plugin for jQuery. Turns out that in order to use it a page HTML must containt the following code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <?import namespace="v" im...

Error #3115: SQL Error.

I keep getting this error when I try to commit a group of executed statements. Details are blank and the message just doesn't give enough information ('SQL Error' only). Anyone run into this error, or have any ideas? ...

appendchild on mouseover

I'm searching and displaying results from an xml file using combination of javascript and jquery. The results are displayed as thumbnails which upon clicking should bring up more information in jquery colorbox. The information in the colorbox comes from inline hidden div(#affInfo). I'm trying to append a new div(pWindow) to the hidden di...

Respone.Redirect causes error once in a while, but i can't reproduce it

Hi, I have a website that will log the user out after a while of inactivity. This is done by the following code: window.location = "./logout.aspx?timeout=true"; But three times in the last couple of days I have received the following exception: System.Web.HttpException The file '/NIR310/Person/logout.aspx' does not exist. at S...

jquery link handler with google ads link

my jquery jQuery(function(){ jQuery('div.class a').click(function() { alert("hello"); }); }); google ads link <a id="aw0" class="adt" target="_top" onmouseover="return ss('','aw0')" onmousedown="st('aw0')" onfocus="ss('','aw0')" onclick="ha('aw0')" href="/aclk?sa=l&ai=BH3xd2ZmTSvrMC5iKqAO2v7XDBv6jtl-mg...

Is it possible to detect animated gif images client side?

Is it possible to detect animated gif images client side? In Internet Explorer you can use the onload event for this, since it willl be fired for every frame loaded (behaviour changed in IE8). But is there a way for other browsers too? ...

A weird regex problem

The following code results in "undefined" for lastIndex: var a = /cat/g; var l = "A test sentence containing cat and dog."; var r = a.exec(l); document.write(r.lastIndex); However, it works perfectly for r.index (and r.input). I am using Firefox. Does anybody have a clue? EDIT: OK, the above code works perfectly in IE! Further,...