javascript

Dynamic CSS3 prefix user agent detection

Is there a better way then using jQuery.browser, or equivalents, for determining css 3 prefixes (-moz, -webkit, etc), as it is disencouraged? Since the css is dynamic (the user can do anything with it on runtime), css hacks and style tag hacks can't be considered. ...

YUI: What is the semantic of Module.destroy()

I am using a YUI Tooltip to show an error message when users mouse over an error icon displayed next to a form field. When the error goes away, I remove the alert icon from the DOM, and want to remove the tooltip as well. For this I call tooltip.destroy(). Is it the right way to do this, or is the destroy() intended for something else? T...

javascript bookmarklet to click Accept on a Facebook Page

I need a javascript bookmarklet that will click the "Yes" button on a facebook page for farmville (or any similar facebook game). The page would say soemthing like "Would you like to accept this gift" and there are three buttons. YEs, Yes and send thank you gift and No. I want to select Yes via javascript. Information related to th...

jquery extend - array of objects

Say I have a Form object which has an array of Tab objects. var Tab = function (options) { return ($jQuery.extend(true, { id: 'foo', title: 'Foo' }, options)); } var Form = function (options) { return ($jQuery.extend(true, { id: 'foo', tabs: [new Tab()] }, options)); } I can use this: ...

Debugging ActionScript in Browser

I am trying to implement following: http://stackoverflow.com/questions/668377/how-can-i-start-a-flash-video-from-javascript However I am unable to call method from Javascript. The trace message I wrote within AS file is not able to see while calling file within browser. How can I test whether my JS function is calling AS method or not...

Log to Safari JavaScript Console

Is there any way to log to Safari's JavaScript console when running with the built-in JavaScript debugger? I've read the Firefox JavaScript logging question and hoping that there is a simple ("native") way to do it in WebKit/Safari. Thanks ...

Problem with geocoding address

I have the following code to geocode the entered address but it displays error saying that variables is undefined ,permission is denied can anyone help to tackle this problem . <script src="jquery-1.3.2.min.js" type="text/javascript"></script> <script type="text/javascript" src="json2.js"></script> <script type="text/javascript" src="ht...

How to use PHP to return a count of images in a directory?

I have a Javascript object like this: var count = { table:19, people:39, places_details:84, story_1:18, story_2:6, story_3:11 } Each item (table, people, etc.) is a directory within my graphics/ directory at the site root. I would like to use PHP to ...

Javascript Arrays - Specify Key

Is it possible to create a javascript array similar to PHP's method which allows you to define the keys during creation? $arr = array("foo" => "bar", 12 => true); Or can this only be done like: myArray["foo"] = "bar"; myArray[12] = true; ...

Passing parameter to a JavaScript function as a Dictionary object

Please, help me to understand the following part of the code from the post http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit/133997#133997 function post_to_url(path, params, method) { .... for(var key in params) { var hiddenField = document.createElement("input"); hiddenField.setAttribute("type...

Javascript OnChange detection for textarea

I have a textarea, a button and some drop down lists. The user goes through the ddls and answers some questions and I generate text in the textarea based upon the drop down lists. At a certain point in the questioning, the button becomes visable for submission; I'm not actually submitting the page onclick, I'm doing other client side s...

Need help using this function to destroy an item on canvas using javascript.

Hi All, I have the following piece of code written using mootools and mootools canvas library. CANVAS.init({ canvasElement : 'canvas', interactive : true }); var itemlayer = CANVAS.layers.add({ id : 'items' }); for(var j = 0; j < 5; j++) { for(var i = 0; i < 5; i++) { itemlayer.add({ id : 'item-'+i + '-' + j, x ...

Getting the bounding selection rectangle of UIWebView

How do we get the on-screen location of a selection in UIWebView? That is whenever the user selects some text and the system displays the selection box, I want to know what is the bounding coordinate of the rectangle in screen (or view) units. The reason for this that I want to display a UIPopoverController that has an arrow pointing to...

Capture first frame of an embedded video

Hi, I want to capture the first frame of an embedded video as an image without using any server side scripting. Probably with javascript, is it possible? ...

Clip content from remote website using javascript and Iframe ??

Is there any helper for Iframe in Rails ?? *EDIT:*I have a link which redirects to a remote website , i need to get the COntent from that website and store in my application is this possible , I dont need a browser extension or plugin. ...

How to play google tts on click using javascript

I'm trying to write a js function that can speak certain text, like this" function SpeakText(text) { ...... } I found this tread: http://stackoverflow.com/questions/3341575/how-to-create-a-button-that-plays-a-mp3-google-tts that seems to do what I want. But I tried the solutions but doesn't work. Maybe it requires html5 to work? Is t...

Download File Using Javascript/jQuery

I have a very similar requirement specified here http://stackoverflow.com/questions/1296085/download-file-using-jquery need to start download a file when i manually calls $('a#someID').click(); But I cannot use window.href method as solution since it replaces the current page contents with the file you're trying to download. Instead I ...

Cant access values inside my iFrame it gives me permission denied

Hello I cant access values inside my iFrame it gives me permission denied. I have access on both pages (parent and child). I added the following javascript line on both pages: document.domain = "sub.domain.com"; but firebug gives me : Illegal document.domain value and when i try to access element inside the iFrame it prompts : Permi...

Detecting 're-write type framebusting' where the URI and frames stay in place

I'm working on a site (http://newscrud.com/) that puts warning label images over the top of badly written internet news articles. I implement this with an iFrame with the warning labels on the outer frame, if the framed article wants to bust out of the frame, I let the user know so they can cancel it if they want. This seems to work ok...

Hiding a text box in a form using javascript

What is the correct way to hide an input text box? The following appears to work to work in all browsers except Internet Explorer. I am testing on IE8. var field = document.getElementsByTagName("input")[0]; field.type = 'hidden'; For the record the following does not work: var field = document.getElementsByTagName("input")[0]; field....