javascript

Cross-browser JavaScript input live change/paste detection

Is there a cross-browser way to detect live changes to an input field? By live, I mean not when the field loses focus, and not on the next keypress, and so on. Immediately or something like it. Using combinations of jQuery and .change(), .keyup(), .bind('paste') and so on I can get working live change detection in some browsers, but no...

Problem with the redirection: Twitter API Oauth

Hello everyone, I'm testing the twitter API (with OAuth) and I have a little problem, I wonder if anyone knows how to fix it, the situation is that at the time I do this (in my redirect.php): $ Url = $ connection-> getAuthorizeURL ($ token); header ("Location: $ url"); The request go to twitter, and it's authenticated, but I this ret...

Firing a keyboard event, webkit keyboard event doesn't fire

I have javaScript code that listens to the "return" key pressed, works on all browsers except webkit browsers. I am aware of webkits recent changes to keyboard event handling. I cant find the right solution in this detailed explanation. here is the code. function addEventHandler(node,type,fn){ if(typeof window.event !== "un...

JavaScript inheritance with Object.create()?

Hi, How do I inherit with the Object.create()? I tried these, but none are working: var B = function() {}; var A = function() {}; A = Object.create(B); A.prototype.C = function() {}; and var B = function() {}; var A = function() {}; A.prototype.C = function() {}; A = Object.create(B); and var B = function() {}; A = Object.create(...

IE8 Throwing a Security Error with MooTools

Okay so like everything else IE8 is giving some serious problems. When trying to load MooTools into the browser IE8 just gives me a "A security problem occurred" error. I think it may have something to do with the clashing of files or something but I can't seem to figure it out. Here's a web address so you can see for yourself. http://w...

Display welcome message to first-time visitors

Looking for a simple way to show a welcome message to first time visitors on my website. What's the best approach? ...

merging my CSS and JS files breaks code (working on mac, not on my server)

I'm merging (and afterwards minify with YUI compressor) my CSS and JS files. My web application works fine when just linking the separate files. Now I want to merge the files as one CSS file, so I just basically do the following: find /myapp/js/ -type f -name "incl_*.js" -exec cat {} + > ./temporary/js_backend_merged.js That merges al...

return data from jquery $.post

I want to have a simple function where i can insert a sqlQuery and get a database answer in json-format like this: function ExecuteQuery(query){ $.post("sql.php", { "query": query }, function(data){ return data; }, "json"); } The response i get is undefined, I think i have misunderstood something quite basic but i ...

Match and replace whole words in javascript

I have a textarea.I want when I write ,for example "want", to replace it with "two". How to match and replace whole words in javascript? ...

HTML5 Canvas Error

when i try to run this javascript it says that theres an error "INDEX_SIZE_ERR: DOM Exception 1" Javascript: blocksize=50; ctx=document.getElementById('wizard1').getContext('2d'); ctx.drawImage(document.getElementById('wizard.png'),0,0,105,105,0,0,3/7*blocksize,blocksize); HTML: <canvas id='wizard1'></canvas> <img id='wizard.png' sr...

Javascript color gradient

Using javascript with or without Jquery, I need to a create a gradient of colours based on a start and finish color. Is this possible to do programmatically? The end colour is only ever going to be darker shade of the start colour and it's for an unordered list which I have no control over the number of li items. I'm looking for a solut...

How to tell what's causing slow HTML5 Canvas performance?

How can I tell if the canvas's slow performance is caused by the drawing itself, or the underlying logic that calculates what should be drawn and where? The second part of my question is: how to calculate canvas fps? Here's how I did it, seems logical to me, but I can be absolutely wrong too. Is this the right way to do it? var fps = ...

Make a <br> instead of <div></div> by pressing Enter on a contenteditable

I've written a bit of code in my keyboard event handler to insert a <br> in response to the press of the Enter key: event.preventDefault(); document.execCommand('InsertHTML', true, '<br>'); This only works if the cursor is between two Letters, if its on the end i need two <br>-Elements. Can i detect if i'm on the end of a Line? Or som...

How do Object() and new Object() differ in JavaScript?

In JavaScript, what's the difference between var x = Object(); and var x = new Object(); ? ...

Plain JavaScript execution in Firefox/Internet Explorer after browser navigation

Hello there, In IE8, history navigation (back/forward) causes code to be executed on the onload handler. How can I get Javascript in Firefox to also execute after a back or a forward? Thanks ...

get all the ips that are viewing my web page

Hello there ! What's the best way of getting all ip's that are curently viewing my web page and show them like a list (on another page) and update when a client is leaving or entering on my page ? And this using html ,php, javascrip , mysql , and stuff like this. ...

How can I adding/delete a table row using JavaScript?

I'm looking for a simple, effective technique for adding or deleting a row in a html table using JavaScript. (Without using jQuery) ...

How to force DOM modifications done in success function persist within a jQuery.Ajax() call?

Hi, I am getting a JSON object from a webMethod by the call below and I set some textBox values based on the returned objects attributes. Problem is, just for a moment my textBoxes are populated but then immidiately they return back to empty. Do I make a mistake or I cannot make DOM elements modifications within a success function? T...

iphone native app in html/js interactivity

Is it possible to communicate between Objective-C and JavaScript? Call a JavaScript function from Objective-C. Call Objective-C function from JavaScript? If so how? ...

update facebook open graph meta tag through js

I'm trying to update the meta content of the fb's open graph title. I updated the content but when it published the feed, its still pulling the old info. Example: <meta property="og:title" content="Title 1"/> I managed to update to <meta property="og:title" content="Title 2"/> When I click on the FB like, its still pointing the titl...