javascript

What is the best way to incorporate simple, utility objects into more complex, specialized objects?

I am developing some basic utility objects in javascript. These are things like: spinner { // generates a spinner } dialog { // generates a dialog } wysiwyg { // generates a wysiwyg editable } etc. Once I have amassed a collection of basic utility objects, I would like to create more specific, complex objects for working on differ...

Does anybody know how to generate 4 colors with new brightnesss based of a color in javascript?

Hey I was wondering if anybody knew a way to generate some monochromatic colors based off a single color inputted in hex into a javascript function. ...

Packing tree into array in Javascript

Ok, so this shouldn't be difficult, however I have encountered weird and bizarra flukes. I am trying to pack a tree into an array, where each node is something like: title: string-for-display key: id-value children: array of child nodes the fluke is so strange I can't comprehend it at all: when I try to add a child to a node, I do...

Why does Javasript's strict comparison act the way it does?

Possible Duplicate: Is JavaScripts math broken? If the main difference between Javascript's "strict comparison" operators and the traditional ones is type coercion, why does 0.1+0.2===0.3; return false? Riddle me this, Batman. ...

Looking for a mouseover sound script (solved)

Hi, I'm looking for a a mouseover sound script (for button). I plan to use wav sound but can be other sound format. Those I have found on the net are not compatible with new browser version. Especially need to work in Firefox Browser. I have found one on Jquery site but it require Flash. I prefer using only javascript if possible. T...

Efficient HTML Div with hole in it

Let me explain a bit more, I am trying to have a large area (full screen) with a fixed size hole in it. The hole will follow the mouse around the screen. Think of having a scope focused on the page and the rest of the page grayed out. I need this working efficiently in all browsers (inc IE 6). My current solution uses 4 divs (top, rig...

can you add two fields on a website?

Hi all, I am trying to have a user imput data into several fields, then I want to be able to add that value and take a percentage of it. I realize that I could just add the variables, however I would like the user to be able to see the total and the percentage. If you would like to look at the site just for reference, http://clubs.ps...

<canvas> javascript game frameworks

Do you know any except GameJS, which actualy isn't working on my pc, in FF3.5 i try to start attached jetris demo and i see nothing, even firebug console is clear. I tried something called GameQuery, looks nice but it's working on pure DOM, im interested in CANVAS. ...

A random number generator statement in a loop is giving me the same number every time. Javascript

So I am writing this loop, and I have a random number generator in it. How come it only picks one random number for all the iterations of the loop instead of a new random number? here's my code: for ( i = 0; i < 25; i++ ) { var randNum = 0; var randNum = Math.floor(Math.random() * 5); } this is in the chrome browser. Is there someth...

Is there a way to set the default "viewing" index for a DropdownList via Javascript?

Hello, I have a Dropdownlist or maybe better described as a "select" control. This list can have 50 to 100 items in it. Lets just say it's showing numerically 1 through 50. I would like the control to show on the form with no selected value, however when the user clicks/focuses on it - I would like to have what appears to the user as t...

Valid way to add noscript in head for wrapping redirect

So I was thinking a simple way to deal with javascript being disabled by the browser would be the following: <head> <title>JavaScript Test</title> <noscript> <meta http-equiv="Refresh" content="1;url=nojs.html" /> </noscript> </head> And having the nojs.html have somethin...

DataView hides spawning ComboBox

Hi all, I posted this at the Ext forums a couple of days ago, but no response, so maybe better luck here. I currently have a combo box loading data from php through ajax. Everything works fine except that when my results are returned, the DataView covers the ComboBox (fig 2.) I have included the relevant code below, so any help would b...

Autocomplete Search Component for TextBoxes in ASP.NET

I'd like to use a component similar to the Tags autocomplete component used by Stack Overflow in my ASP.NET 2.0 application. What can I use? ...

remove the default phone number sample while entering

Hi ,sample site The above is the sample site , please look the phone number textfield in that site , How they are doing such thing, how to show the default phone number format value in the phone number text field , and how to remove that format while user entering the phone number, Is there any jquery function there, or we have t...

OO JavaScript: Accessing another method of the same object?

I have a JavaScript object called ShippingUI: function ShippingUI(){ ... } It has several methods: ShippingUI.prototype.UpdateItemQTYs = function(ItemJQOBJ, NewQTY) { ... } ShippingUI.prototype.EH_SortableRecieve = function(event, ui) { ... } The "EH_SortableRecieve()" function is a drop event handler. When it runs, it n...

How to convert sequence of numbers in an array to range of numbers

In javascript how to convert sequence of numbers in an array to range of numbers? eg. [2,3,4,5,10,18,19,20] to [2-5,10,18-20] ...

Chrome desktop notification example?

Is there an hosted example code (Javascript) that demonstrates Chrome desktop notifications? I'd like that use that in my own code. Update: Here's a blog post explaining webkit notifications with an example. ...

When should you use "prototype" during object augmentation in javascript?

I'm confused about the notion of "prototype" in javascript. When I'm defining an object both of the following seem to work: myObject = {}; myObject.prototype.method1 = function() { ... }; myObject.prototype.method2 = function() { ... }; myObject.prototype.method3 = function() { ... }; and... myObject = {}; myObject.method1 = functio...

Javascript switch statement with wildcard?

If my javascript ajaxes away to my server and returns an ID of 49 in the plain text format of [49] is there a way in which i an do something like this... (i have tested and doesnt work) switch(data) { case '[*]': (..etc.) break; } Where the wildcard is the * and i want to make sure it is enclosed within two square pare...

how to use Tinymce on zend framework ?

hi all i need to use Tinymce in my project on zend framework, but i dont know how to use of it ! anyone may help and give an example? thanks ...