javascript

regex and javascript, some matches disappear !

Here is the code : > var reg = new RegExp(" hel.lo ", 'g'); > > var str = " helalo helblo helclo heldlo "; > > var mat = str.match(reg); > > alert(mat); It alerts "helalo, helclo", but i expect it to be "helalo, helblo, helclo, heldlo" . Only the half of them matches, I guess that's because of the space wich count only once. So I ...

quickest way to make clickable imagemap of the US

Hi, what is the quickest way to make clickable imagemap of the US? Is there any jquery plugin available for this? Thanks ...

Track button click within a iframe

Hi, Is it possible to track a button click within an iFrame if i don't have control over the external website or it's contents? (very fictionnal example)if i had an iframe like this: <iframe src="http://www.johnny.com/plugins/like.php?href=http%253A%252F%252Fexample.com%252Fpage%252Fto%252Flike&amp;amp;layout=standard&amp;amp;show_fa...

FlexScroll and IFRAMES

Hey, I was wondering whether there is a way to use FlexScroll (JavaScript custom image based scrollbars) with IFRAMES instead of the DIVS. Yes, I know scrollable DIVS are better than IFRAMES. This is my clients requirement though. Cheers. ...

How to loop through items in a js object?

how can I loop through these items? var userCache = {}; userCache['john'] = {ID: 234, name: 'john', ... }; userCache['mary'] = {ID: 567, name: 'mary', ... }; userCache['douglas'] = {ID: 42, name: 'douglas', ... }; the length property doesn't work? userCache.length ...

jQuery Validation plugin: disable validation for specified submit buttons when there is submitHandler handler...

Ok, I am using umbraco forum module, and on the comment form it uses jquery validate plugin. The problem is that I have added a search button on the same page using a UserControl, the search submit button triggers the comment form submission validation. I have done some research, and added the 'cancel' css class to the button. This bypa...

Javascript functions return lines of function code or "{[native code]}," what am I doing wrong?

I am writing some code to find the user selection in a contenteditable div, I'm taking my code from this quirksmode article. function findSelection(){ var userSelection; if (window.getSelection) {userSelection = window.getSelection;} else if (document.selection){userSelection = document.selection.createRange();} // For microsoft...

Mobile WebKit browsers - setTimeout and inactive pages

I have a question regarding how Mobile WebKit browsers (ie Mobile Safari and Android browser) handle setTimeout function when the page becomes inactive and is reactivated again. Let's assume the page becomes inactive (ie the phone screen goes to 'sleep' / we open another application / we open another webpage), and the setTimeout functio...

Javascript and timing, specifically with callbacks.

I want to make sure I understand callbacks properly, and javascript timing etc. in general. Say my code looks like this, is it gauranteed to execute in order? SetList(); // initilizes the var _list Some.Code(_list, function(data) { // update list }); DoSomething(_list); // operates on _list Update What I am seeing is Se...

Jquery JSON .each() doesnt work in Google Chrome

I have a really simple chat application on a site which works pretty good. It requests by ajax like this: $.ajax({ url: "fetch/"+CHAT_SESSION_ID+"/"+LAST_MESSAGE_ID, dataType: "json", cache: false, success: function(data) { if (data.session_active == 0) { //If other chatter ended session alert("Session Ended"); } ...

Check through Javascript that page is loading something

When the browser is loading something on a page you can see it in the status bar that it says "Waiting for..." or "Transfering..." etc. In firebug you can check in the net tab when something is being loaded and see when it stops. That is what I want. Is there a way for me to trigger an event when that happens ? Or to get the status o...

jQuery UI datepicker will not display - full code included

I am having trouble displaying the jQuery datepicker as shown here: http://jqueryui.com/demos/datepicker/ I believe I downloaded all of the proper files, but to be certain, I started from scratch and ripped the demo site. Not all of it, but what I believed to be the important parts. The result is no datepicker to be shown and no javas...

Using Javascript to expand DIVs and go to anchor text

I apologize that this question is so similar to "How can you check for a #hash in a URL using JavaScript?" but would appreciate your help with the following. I would like to use Javascript to display text that is a) identified by an anchor. b) contained within 2 collapsed DIVs....ONLY WHEN the anchor is in the URL. Otherwise, the page...

Helper code to write to firebug logs, that doesn't break if using IE/Chrome etc.

Is there any helper code out there that will allow me to write to firebug's log window, but at the same time not break if using IE/chrome etc. ...

dragging object from html page using (using javascript) into a flash container?

I am doing some pre-production on a project that requires drawing on a 3d canvas, which I think flash is the best way to go. But there is a chance down the line that this client might want the site to show up on the ipad, iphone or other mobile devices that don't support flash. So I was playing with the idea of doing everything in html...

DOM: I can't access dynamically created elements. What's wrong.

I am creating a form with AJAX. The way I have created the form is by writing out the html form elements in the innerHTML of the div where I'm putting the form div.innerHTML += '&nbsp;<input type="text" name="day" id="eventDay" size="2" maxlength="2" value="'+response.day+'" />,'; div.innerHTML += '&nbsp;20<input type="text" name="year"...

jquery find if variable is divisible by 2

How do I figure out if a variable is divisible by 2? Furthermore I need do a function if it is and do a different function if it is not. ...

TinyMCE with AJAX (Update Panel) never has a value.

I wanted to use a Rich Text Editor for a text area inside an update panel. I found this post: http://www.queness.com/post/212/10-jquery-and-non-jquery-javascript-rich-text-editors via this question: http://stackoverflow.com/questions/1207382/need-asp-net-mvc-rich-text-editor Decided to go with TinyMCE as I used it before in non AJAX s...

Use a table as container or not?

I have created my entire website by using a main table, and having the content inside the table. Some ppl suggest this is wrong, and I would like to know what to do specifically in my situation. On my index.html I have a <table align="center"> and then all content in it. Now the content is in form of DIVS and they all have relative po...

Javascript to detect where newly opened window came from

Let's say I have a page, http://mydomain.com/mypage.html, with a "Back to page" link. This link should take the user back to the page where they came from only if the previous page URL matches one of the following: http://mydomain.com/one.html, http://mydomain.com/two.html, and http://mydomain.com/three.html. Otherwise, it would take t...