javascript

jQuery ~ Adjusting href before following it

I have a link with a series of checkboxes, due to the legacy code, when the user clicks on a checkbox the value of it is appended as a comma deliminated list to the href. The trouble is that now that I'm updating the code, I'm finding that the href is being followed quicker than the href is being adjusted, thus the list is being exclude...

Can't call Flash (Swf) method from Javascript within QWebView

Hello, everybody! I have: Swf-file, that a) makes one of its method available to the outer world through ExternalInterface.addCallback; b) calls predefined outer world method through ExternalInterface.call; html-page, where this Swf-file resides. There are two javascipt methods in this html: one for calling Swf-published-method and on...

Does 'separate domain sandboxing' (protecting from JS cookie hijacking) still work with a subdomain?

I think the title says it all, prettymuch. A little further detail: I'm running a site where users can submit Javascript freely Other people will preview this Javascript 'live' There will be basic measures in place to stop naughties like eval(), but inevitably some may unfortunately slip through The site is mysite.com, I gather runnin...

Is there any PHP (or similar) version of Google Caja that can be practically run from a shared host environment?

Hi folks, I'd love to use Google Caja to run user-submitted Javascript 'live demos' in a sandboxed, safe environment, however I see it's Java-based and really have no idea how I'd practically set this up on a shared host (specifically, MediaTemple's (gs)). On (gs) I have access to SSH and can install things via command line but it is ob...

HTML Form submit event lost if DOM was modified through AJAX

I have a form with input fields and submit button. Each input's blur event is observed (using prototype) and a new Ajax.Request is fired for server side asynchronous validation. The Ajax response text modifies the DOM tree by updating the error texts and error div styles. Everything works fine, except when I left some input element, clic...

get current latitude and longitude from gps enabled device

Dear all, I would like to get the latitude and longitude of current location from gps enabled mobile device right from the web browser. May I know is this possible? how to do it? does it require geolocation api? Some coding example would be helpful. Thanks. ...

Greybox: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus

Hi, I have a page that loads within a greybox. I set the focus with document.getElementById("textfield").focus() - this works fine when calling the page directly. But when loaded in a greybox, setting the focus on the onload() event returns Can't move focus to the control because it is invisible, not enabled, or of a type that does n...

jquery reset append()

How can I reset after append() or before()? Please help. Many thanks in advance. if((#tag_id).text() == 'something'){ $(#tag_id).before("x"); } // I want to reset the #tag_id to empty $(#tag_id).val(''); // this doesn't work ...

Adding a prototype to an object literal

I have some object, say son, which I'd like to inherit from another object father. Of course I can make a constructor function for father, like Father = function() { this.firstProperty = someValue; this.secondProperty = someOtherValue; } and then use var son = new Father(); son.thirdProperty = yetAnotherValue; but this is not ...

Can a JavaScript variable be used in plain HTML? ** EDIT

What I mean is, can a variable/array declared and initialized be used in HTML, outside the <script>-tags? Fx. <script type="text/javascript"> var foo = array('placeholder1', 'placeholder2'); </script> <body> <p><!--access the variable here-->foo[0]</p> </body> How do you access the variable/array in this case? like this: <p><script ...

Server-Side callback function to solve JS-CF execution order dependency?

I would like to call a form as pop-up window (a form with some input fields and a submit button) and then read the user selected results from the session. The problem is that the mixing of JS code (pop-up window) with CF (server-side) code, as is expected, causes the process to output the session variable before the process updates it. F...

Javascript REGEX: How to get youtube video id from URL?

I want to get the v=id from youtube's URL with javascript(no jquery, pure javascript); Example Youtube URL formats: http://www.youtube.com/watch?v=u8nQa1cJyX8&amp;a=GxdCwVVULXctT2lYDEPllDR0LRTutYfW http://www.youtube.com/watch?v=u8nQa1cJyX8 or any other youtube format what contains a video id in the url Result from these formats ...

How do I call a javascript function once a silverlight control has finished loading?

I need a silverlight xap to notify the page somehow once it's finished loading. I was trying to use Javascript to call into the control via $(document).ready(...) but it looks like ActiveX controls can continue loading after the document ready event fires. Is there an event on the object tag I can have call a function? ...

Stopping select.change from posting back

Hi, this problem is part of a bigger page but I've simplified the code to provide an easy example of what I'm talking about. Basically I have an ASP dropdownlist with AutoPostBack="true" and I want to do some javascript client side which can stop the postback if necessary. However, I can't get it to stop the postback. <script type="te...

does IE8 support out-of-the-box in 'localStorage'

I am trying to use html5 feature 'localStorage' according to this blog it can be done using IE8 however when I am trying use it I get javascript error the 'localStorage is null or not an object' So my question- can it be used by IE8 out-of-the-box or not? Here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...

Referencing Firebug Console Inside of a Custom Javascript Object

I have several custom Javascript objects and want to do some debugging via the Firebug console inside of them. However, if I try to use console.log(), I get an error about console not being defined. I tried referencing console as window.console and it made no difference. When I run a check to see if console is defined, it returns false: ...

jQuery Marquee - like Pandora

I'm trying to make a marquee -- via jQuery, that is like Pandora's. I want it to make it only start scrolling if 1) The width of the element would be cut off 2) If you're hovering over the element. It should revert back to normal when you mouseoff it. Here is what I have so far, which almost works: var h3 = $('h3:first'), h3Width ...

Cross domain AJAX with Basic Authentication?

I have a ColdFusion application that's behind an ISA Server. Part of the application is protected by Basic Authentication and part is not. ISA Server sets a cookie when the user logs in, but the cookie is only available for reading when I bypass ISA. So, the cookie cannot be read from the server where the application is running. I'm tr...

Language recognition and automatic textbox direction switch

Hi everyone, Say I have a textbox in HTML using the following code: <input type="text" name="text" id="text" /> And my site is intended to be for right-to-left as well as left-to-right languages. That means that I have some textboxes that will be typed in a right-to-left language, but the email textbox, for example, will be left-to-r...

Unable to capture Ctrl+Alt+Arrow key event in jQuery

For some strange reasons I can't capture Ctrl+Alt+Arrow key combination inside textarea. Is it some sort of system hotkey that is getting swallowed by Windows? Ctrl+Alt+<Any Letter> and Ctrl+Alt+Shift+Arrow are getting captured fine. $(document).ready(function() { $("textarea").bind("keydown", function(event) { console.log(e...