javascript

Using constructor without operator 'new'

Please help me to understand why the following code works: <script> var re = RegExp('\\ba\\b') ; alert(re.test('a')) ; alert(re.test('ab')) ; </script> In the first line there is no new operator. As far as I know, a contructor in JavaScript is a function that initialize objects created by the operator new and they are n...

Selectively disable specified referenced javascript files on Firefox

Is there any way to selectively disable specified javascript files on Firefox/Firebug? Perhaps using another add-on? I'm facing drag/drop conflicts between several static javascript files and I want to disable them one by one until finding the conflicting one. ...

Can't get URL changed from IFRAME

Hi there, I have an IFRAME with a src that is a login, i'd like to know, in any way, if it has been logged in, so i tried to check if the URL has changed getting the .src property, and it is the same that the original. Is there a way, i know about the restrictions problems (it's not in my domain the url that i'm trying to get) to see if ...

Supplying non-minified CSS/javascript on demand

Minfying your stylesheets and script files improves your site's performance. However, sometimes you might want to make the non-minified versions of the files available - perhaps to comply with the GPL or to implement the optional code-on-demand REST constraint. Is there a standardised way of doing this? The only way I can think of is t...

Make text selectable in html pages looking like iPhone forms

I am working on an application than needs to create pages looking like this: http://iui-js.appspot.com/samples/music/music.html#_usage The problem I have is that, just like in the page linked above, the values are not selectable neither with iSafari nor with the desktop version of Safari. I need to be able to select and copy the val...

Toggle form visibility with javascript

I'm using this code to display several forms on my page based on the link chosen by the user: <ul class="nav"> <li><a href="#" onclick="$('#more_info').toggle(); return false;"> More Information</a> </li> <li><a href="#" onclick="$('#road_test').toggle(); return false;"> Book a Road Test</a> </li> <li><a href=...

WPF WebBrowser Silent mode through IWebBrowser2 interface not working?

I'm trying to silence Javascript errors in the WPF webbrowser control. According to the "Getting to the native IWebBrowser2" comment on this page, one can access the IWebBrowser2 interface. From there I thought I could set the Silent property to true, like this: /// <summary> /// Handle navigation events /// </summary> p...

Facebook developer: making a permission optional

Facebook requested that I change my design of my application because certain functions become deprecated. Now I have to ask the user for "publish_stream" permission when he logs in. When the user allows the permission, he is redirected to the website and everyone's happy. When he doesn't allow -> he is being requested again and again u...

Chrome Extension using popup bar

I'm trying to make something similar to the picture below. http://img696.imageshack.us/img696/8844/testi.jpg Unfortunately, I can't seem to get it to work within the extension. I get an error stating there was "Error loading the document". The screenshot above was done using a locally made html with the iBox javascript. Is there any ot...

Convince me to switch from YUI 2 to YUI 3

Hi ! I've been using YUI Library to develop websites. YUI 3 came out on september. I'm still not convinced if i have to prepare myself for a migration. What are the advantages of 3rd version over the 2nd ? Have you been involved in such a migration, lately ? ...

Javascript alert with confirmation

Hi, I have a javascript alert popup on my page. Problem I am having with it is that instead of waiting for the user to actually click the OK button, it simply does a redirect, something it ought to do AFTER the OK button has been clicked. Can anyone please help me tweak my code so as to get this working as it ought to please? function f...

Reload JsonStore making OPTIONS request

Why is a call to the reload method of a JsonStore making an OPTIONS request to the server? When running under IE, the reload makes a POST request, but under FF an OPTIONS request. Can I prevent FireFox (or ExtJS) from making an OPTIONS request? ...

Please help me speed up this mahjong algorithm

I am writing some mahjong-related functions in JavaScript. Here is what I have below, with code for test cases. Note that mahjong hands are represented by arrays, with: element 0 being the total number of tiles in the hand elements 1 through 34 being the number of tiles of each type in the hand first craks, then dots, then bams, the...

Capture clicks in Flash adds

I am trying to track the exit clicks of the users in the adds in my page. Can I somehow capture with Javascript the click event of a user in a external Flash add I have inserted in my page? I have been searching and trying by myself, but it seems like the flash object inside of my page is a black box, where I could not access anyway. ...

quick javascript function help...

I have this function, and I want to pass a variable (z) to the OnClick event of an image. I have this: for (z=1; z<img_src.length; z++){ path_th_img= 'ad_images/'+category+'/'+'thumbs/'+img_src[z]; document.getElementById("thumb_pic_div").innerHTML += "<img src='"+path_th_img+"' class='shadow2' style='margin:7px;' onclick='imag...

Is there a way to update a jgrowl message?

Is there a way using jgrowl(or any other growl like popup) to update a message if it hasn't been removed yet and if it has been removed just simply add it like normal? ...

2D web-game: on what?

I want make 2d fighting game. Without very fast moving and very cool effects. I can do it with jquery, but i think this be a slow. Or not ? Q: Is there an alternative for flash? PS: sorry for my ugly english ...

JQuery tools, overflow images from input box

Hi I'm creating an interface with JQuery tools, using the overlay functions. So, I have a list of a tags that shows images in overlay <a id="11" href="data/images/011.jpg"> <a id="12" href="data/images/012.jpg"> <a id="13" href="data/images/013.jpg"> <a id="14" href="data/images/014.jpg"> then I have an input box (without form tag) ...

Can script.readyState be trusted to detect the end of dynamic script loading?

I use dynamic script loading to reduce the duration of the initial page load. To ensure that the functions and objects defined by a script are accessible, I need to ensure that the script has been fully loaded. I have developed my own Javascript library to this end, and thus did quite a lot of research on the subject, studying how it's ...

Add base url to all images in an element

I am using a javascript editor called NicEdit which doesn't come with an option to change or reference the base url. I was wondering if this can be done in jquery or javascript? The image src of all images in the DIV element are the same, <IMG border=0 src="/image.jpg"> except the actually images is stored under a different domain and d...