javascript

Alternative to eval

In the following statement, how could I make the "log.entries[i]" part a variable? json.log.entries[i] eval works but I don’t want to use it. eval("json" + "var") I also tried: json[var] Thanks ...

Is it possible to upload to Cloudfront via Javascript preferably using Gears for uploading

Is it possible to upload to Amazon Cloudfront using Javascript preferably with the use of (Google) Gears for uploading chunks? I'm building a CMS for images and video data and want to integrate Cloudfront as a storage backend. To avoid first uploading to Google Appengine (which is where my system is hosted) and then from there upload th...

p2q_EmbedFlash using remotely hosted Flash files

I've embedded a virtual tour on one of my client sites. The site is hosted by Slicehost, and as you can see the load times for the Flash movies are very slow, so my idea was to serve the swf files from Amazon S3 Europe. To test it, I have all swfs uploaded to the same directory / bucket on Amazon, while the index.html and p2q_embed_ob...

determining mouse position on a window focus event

I've attached a focus listener to window (using prototype syntax): Event.observe( window, 'focus', focusCb.bindAsEventListener( this ) ); I want to determine the mouse position when the window is focused. Unfortunately, in my focusCb method, I don't seem to have access to pageX, pageY, clientX or clientY. Using quirksmode code: fun...

jQuery's load() doesn't display images

Good evening everyone, I am using a JavaScript to load/override content from an HTML-File into specified divs. You can watch a demo. The javascript that does the load job looks like the following: function loadScreenie(elementSelector, sourceURL) { $(""+elementSelector+"").load("img/screenies/"+sourceURL+""); } and gets invoked ...

it's recommendable to place externally loaded content into an iframe?

For instance the Twitter widget, should I place it inside an iframe or directly in the main page, if Twitter goes down can my site goes down if the widget isn't inside an iframe? ...

Sort not compatible with IE?

The code below works fine for dynamically reordering links in firefox, but for some reason not in IE (version 7). Any ideas what part of the code is causing problems? Thanks. var parent = $('#itemHolder'); var children = $('a', parent); var children = $('a', parent).sort(function(a, b) { return parseInt($(b).attr('amount')) ...

removing part of string UPDATED

www.powersource.se The last link, "Add some stuff" doesn't work properly. It's supposed to add a bit of text when you press it and then remove the text when you press it again. I've made the add-part work, but I haven't managed to make the remove-part. function add_module(title, text) { container = document.getElementById('text-main');...

call JS function via url

hi there, i got a got a little embedded system that can be controlled via a webinterface. the page looks like: ... <a href="javascript:foo(bar)">foo</a> ... is there a way to call this function just by http? like http://&lt;the-devices-ip&gt;:80/javascipt:foo(bar) //wrong thank you ...

url paths for resources

Hi , i am a newbie on web development, so i have some problems first of all what is the meaning of ~, / on an url? My real question in my javascript code i am doing some ajax calls with jquery like that $.ajax({ ... url: '/Membership/Login', ... }); There is an Membership controller with an Login action method that i need to s...

Concatenate a date and time value

Hi, i need to concatenate a date value and a time value to make one value representing a datetime in javascript. thanks, daniel ...

Best practice for filtering items client-side with JavaScript, hide or remove from DOM?

I have a relatively large dataset of items (a few thousand items) that I want to navigate by applying a number of filters client side in a web application. Applying the filtering logic itself is not an issue, the question is about which method to use for updating the table of matching results to get the best user experience. The methods ...

How to keep a HTTP connection alive?

Is there a way to keep a HTTP connection alive with JavaScript? ...

automate navigation of a JavaScript powered website

Hello, I need to automate navigation around a JavaScript powered website so I can scrape some content. I came across Chickenfoot, which is a FireFox extension that gives me a programming interface to the browser. Do you know of other solutions? ...

run javascript in C#

I found a fairly complex function in a greasemonkey script that i would like to use in my C# app. Basically i am parsing a page and i need to collect all or 4 members of var avar = {}; (i havent done this yet but they are all strings using var avar.name = "val") Then i need to call the gm func which returns a string and takes in 3 strin...

Can anyone see what is wrong with my Javascript?

I have written the following: var pages=["[www.google.co.uk] This is the WWW. ","[www.yahoo.co.uk] This is also the WWW. "]; function findScoresC(s){ var scores=[]; var words=[]; var wordScore; var indexScore=[]; s=s.toLowerCase(); for(i=0;i<pages.length; i++){ var lowerCaseContents=(pages[i].substring(pages[i].indexOf("]")+1,pages[...

HTML 5 filter language or some analog of filter language?

Is there in HTML 5 filtering language or some analog of filter language? Something like GLSL / HYDRA / HLSL or just JS pixel filter/shader lib? ...

How to I make jqGrid show its edit window in a specified container, not its own modal dialog?

I'm trying to use jqGrid's editing functionality, as demonstrated under row editing in its demos and docs. However, instead of having jqGrid open a javascript modal dialog box, I would like the edit window to appear in an another page element alongside the table. In essence, I want code that reads like: jQuery("#table").jqGrid({ .....

Passing PHP array into Javascript through JSON to update Google Chart

I have three PHP arrays that I've encoded with json... extra PHP code has been omitted because the arrays work properly.... Additionally, the HTML tags that call the google chart have been omitted for sake of brevity... <?php $encoded_line_volume = json_encode($LineVol) . "\n"; $encoded_loan_volume = json_encode($LoanVol) . "\n"; $enc...

Why do I get no source for error in Firefox

The Firebug console gives me: ------------------------------------------ (X) 0 no source for No element with id 'inline_gallery_image_false' found) ------------------------------------------ When I click this error I get a blank source view window. The 'Stack' pane in the Script tab turns up blank as well. Firefox 3.5.5 + Firebug...