javascript

Javascript library to reliably load Java Applets?

Flash users have the wonderful SwfObject JavaScript library that abstracts browser differences to reliably embed swfs into their web pages. Is there a JavaScript library like this for Java Applets? ...

how to print number with commas as thousands separators in Javascript

I am trying to print an integer in Javascript with commas as thousands separators. For example, I want to show the number 1234567 as "1,234,567". How would I go about doing this? Here is how I am doing it: function numberWithCommas(x) { x = x.toString(); var pattern = /(-?\d+)(\d{3})/; while (pattern.test(x)) x = x.r...

How do I clear this setInterval

Normally, id set the interval to a var and then clear the var like var the_int = setInterval();clearInterval(the_int); but for my code to work i put it in an anonymous function: function intervalTrigger() { setInterval( function() { if(timedCount >= markers.length){timedCount = 0;} google.maps.event.trigger(markers[t...

script running very slow in IE with Jquery quickflip plug-in

I have a jQuery plugin running on my site that is executing very, very slowly in IE7/8 to the point that it throws a slow script warning to the user. It doesn't happen in any other browser, and I can't figure out what might be going on. If you go to this page: << REMOVED >> You'll see that there are 16 results on each page, and each o...

How do you implement file drag-and-drop upload in Google Chrome?

I've found several tutorials online about implementing file drag/drop with Firefox 3.6 (they involve using a FileReader object to get the file binary data). However, I cannot create a FileReader object in Chrome on Windows or Mac. Does anyone know what the API is to read and manipulate data from a drag-and-dropped file in Chrome? If I...

Any difference between lazy loading Javascript files vs. placing just before </body>

Looked around, couldn't find this specific question discussed. Pretty sure the difference is negligible, just curious as to your thoughts. Scenario: All Javascript that doesn't need to be loaded before page render has been placed just before the closing </body> tag. Are there any benefits or detriments to lazy loading these instead th...

jQuery: Div elements are not showing up

I am adapting the Coverflow technique to work with a div. Following is the html: <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <style type="text/css" media="screen"> body,html { margin: 0; padding: 0; background: #000; height: 100%; color: #eee; font-family: A...

Reset element to "default" event

In Javascript, how can you set the event handler of a DOM element to default behavior? For example, suppose I set the onkeypress event of an input element: elem.onkeypress = function() { alert("Key pressed!"); } Later, how can I remove this event? Is it okay to simply set the onkeypress property to null? I tried that and it works, ...

Chrome Extension: How to display tab objects?

I am in the process of designing an extension for Google Chrome that helps to organize tabs (I know, there are many that already exist; that doesn't matter). I wish to open a popup window that will display tabs as objects (i.e., in the same way that it is displayed in the tab bar at the top of the browser). One way of doing this would ...

Is there anyway I can fix a webview?

I am trying to load a webpage into a sample webview that I created: public class HelloWebview extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView web...

*Discussion* Client side page permissions - Javascript / jquery / cookies / other?

TLDR Using plain HTML / Javascript. Want to block access to some pages (doesn't have to be super secure just to stop some peeking eyes). I would like this to be a discussion preferably on different ways of doing this? If anyone has any other ideas than using cookies or differeny ways to do this. I thought of simply doing this by sett...

Match d-M-Y with javascript regex how?

Hi, my date formatting in PHP is d-M-Y and I'm trying to match the dates with a javascript regex: s.match(new RegExp(/^(\d{1,2})(\-)(\w{3})(\-)(\d{4})$/)) To be used with the jQuery plugin, tablesorter. The problem is it's not working and I'm wondering why not. I tried removing the dashes in my date() formatting (d M Y) and tried the...

How to i disable the _moz_resizing?

I am using nicEdit editor and i have added my own custom image resizing script to it. But i want to disable the default _moz_resizing that appears in firefox. I wanted to have finer control over the image being resized. ( Eg: Allow only the image to resize and inherit the width of the parent container. ) So i wrote a custom script. B...

button submit with 2 different behaviour

hi, how could i set a variable with a submit button in order to differenciate 2 behaviours, so first time the same submit button will insert in database and in second time it updates database values. Thanks. ...

Disabling keys in Windows

how to disable ctrl+alt+del,alt+F4,ALT+TAB, keys using JavaScript for Windows? ...

Discussion - Allowing / blocking user access to pages / Client Side Validation (Client Side Only!) - Javascript / Jquery

TLDR Using plain HTML / Javascript (Client Side) I want to prevent viewing of certain pages. The user will have to type a username and password and depending on that they get access to different pages. Answers can NOT include server side whatsoever It does not matter if they can break it easily. There is no sensitive information etc....

Best approach to update a control after an Ajax request?

I have a webpage that fires off an Ajax request which stores some data to a database and I want to update the webpage so that the user can see their changes have been submitted. There are at least 3 ways I can think of accomplishing this: Immediately update the webpage with plain JavaScript by grabbing the contents of the user's input...

javascript instanceof get type from string name

Let's say I have this (assume the name variable is "receiver"): if (!(receiver instanceof com.HTMLReceiver)) { throw new com.IllegalArgumentException( name + " is not an instance of com.HTMLReceiver."); } I'd like to factor this code out into a common method so I could call it like this: Helper.checkInstance(receiver, "co...

document.location

How do you use document.location? Is it HTML or in JS? Please help me out! ...

Javascript using asp.net

I have a Login Page Contains two text boxes one is user name,password and one button if the two textboxes are empty that time how i can avoid post back of the buuton if any value enterd that time only postback occuers,,,, not using required fiekd validator any method is avilable in javascript....... ...