javascript

Can Html5 drap&drop interact with RichFaces fileUpload component?

Hi, My App used JBoss Seam, RichFaces. In the upload photo page, I want to use "drag&drop" a photo from desktop. I have tried with html5 but don't not find a way to interact with richfaces upload file control. Have a way to automatic start richface uploadfile on "ondrop" event in html5? Thanks, Huy ...

DOM event for browser password autofill?

I've got a fairly standard username/password entry box on a web site I'm building. The password box has a div containing "Password" overlaid on top of it, which is set to display: none; on focus or click. This works great until the user asks their browser to remember the password: in that case you can end up with the situation in the ...

Javascript error in IE7 only (jQuery / Cycle.js

I'm using jQuery and cycle.js to fade through some images on this site. On the first and last slides, I've put a callback function to go to the next/prev pages, however in IE7 I'm receiving a runtime javascript error (not in any other browsers). Here's the link to my javascript file: http://bit.ly/dAKEof The error I'm receiving in IE...

infinite jQuery cookie

Hey, I plan to use some music on my site, but before I make it autoplay for each visitor, I would like to have either an alert pop up immediately, asking if they would like the music to play, or a nice little tooltip of some sort to present a message stating that you can check whether or not you would like the music. So, I know I can s...

IE 8 Quirks vs Standards retrieving offsetHeight/offsetWidth

I am in the process of converting my application to use XHTML strict mode (it didn't have a DOCTYPE before). However, I noticed a significant degradation when getting offsetHeight/offsetWidth. This is very noticeable on pages with large number of DOM elements, let's say a table with 1 column by 800 rows, the cells only have a piece of te...

Facebook Stream Publish Issue: Modal stuck "loading..."

I have been experiencing intermittent issues with facebook stream publishes. When a stream publish is called, the modal placeholder pops up with "Loading..." but often never loads. Since the issue comes and goes, I had always assumed facebook itself was the problem. There is no modal error message as would be expected if an invalid param...

Array creation and printing in jquery

I have a whole bunch of divs that have a class called ofint. Each of them may have additional classes. I'd like to store this information about each div and then print them. So I'm trying to loop through all divs of class ofint and store the div id and its classes in an array. The idea is that I'll search the array later, but for now I ...

Trapping click events on <a> elements that are programmatically added to a DOM

I have an AJAX callback that returns a list of results that are written out as links within a specific div. The code goes something like this: $.each(data, function (idx, item) { var a = document.createElement("a"); a.innerText = item.name; a.href = "#"; // TODO set handler for click event d.appendChild(a); d.in...

jquery/javascript: function(e){.... what is e? why is it needed? what does it actually do/accomplish?

$('#myTable').click(function(e) { var clicked = $(e.target); clicked.css('background', 'red'); }); Can someone explain this to me, and explain why e is needed, and what it actually does.. ...

Javascript function testing using gtest

Hi All, I am exploring the possibility of testing javascript functions using gtest. I am just 2 days old in gtest. PLease help. Thanks ...

IS OOP possible in Javascript?

I recently found out that Javascript function can have classes, so I was wondering if OOP is also possible through javascript. Is It? If yes, Could you please point out some tutorials or site, where I can start with? ...

How to STOP a JavaScript function when a certain condition is met

I can't find a recommended way to STOP a function part way thru when a given condition is met. Something like Exit, or Break? I am currently using this? If x >=10 {Return;} other conditions; ...

IE and Firefox regular expression question

Why the following pattern in IE and Firefox matches result different? var str = 'a,b,c , d, e ,f'; var matches = str.split(/(\s+)?,(\s+)?/); alert(matches); IE: a,b,c,d,e,f firefox: a,,,b,,,c, , ,d,, ,e, ,,f how to match like IE result? please answer me :( ie8 and firefox v3.6.8 ...

How to check if a webpage exists. jQuery and/or PHP

I want to be able to validate a form to check if a website/webpage exists. If it returns a 404 error then that definitely shouldn't validate. If there is a redirect...I'm open to suggestions, sometimes redirects go to an error page or homepage, sometimes they go to the page you were looking for, so I don't know. Perhaps for a redirect th...

Recommended Javascript Image preloader

There are a couple of tools and several tutorials (even some including links to github) on how to preloading images and other artifacts, like css and scripts. YUI3 preloader seems to be the most reliable one. Is there a better one? Are there any others that are faster (possibly through parallel loading), more usable or has better browse...

How can I convert this string into a multidimensional JavaScript array

I have a function which receives a string parameter, I need to convert this into an array. For example: var param = "['Presidente', '', ''], ['Gerente de Operaciones', 'Presidente', ''], ['Gerente de Ventas', 'Presidente', '']"; function myFunc(data){ // DoSomethingHere } myFunc(param); I need to convert data into an array, in thi...

Using Jquery for country, city and location

if australia is selected, it will show only city of australia, if city is selected, will only show location of that city ...

lightbox prev next position change

Hi, I am using lightbox slideshow and it is working fine, there is Next-Prev button also in that. But I want it to show at the bottom of the image and also currently it will show only when I mouseover the image, is there any way to show it permanently. I am using Lightbox v2.04 Thanks deve ...

simple javascript close window, no jquery or any other framework

I'm trying to write a simple javascript(no jquery or any other framework) which should automatically close the browser window or tab (if it's open in a tab). I found a lot of examples over the internet but I couldn't find a reliable solution( some of them don't work with IE) . If it's not possible to close the window directly without the...

How to start learning AJAX ?

AJAX - Asynchronous JavaScript And XML What does it include ? html, javascript, XML, jQuery ........... What is the way to start learning AJAX ? Is it basic from html & javaScript ? or on the basis of the language platform ? ...