javascript

What is the default prototype for custom function in JavaScript?

function f() { } alert (f.prototype); // returns something like [object Object] My understanding is by default the prototype of custom function should be null or undefined, can someone shed some light? thanks! See also: How does __proto__ differ from constructor.prototype? ...

How can I use with JS/CSS/HTML5 animation to get flash like animations? eg a PagePeel

Specifically, I am talking about a decent "realistic" looking page peel from one images to the next in a set. This sort of technology will be vital to the success of Apple's new anti-flash, pro HTML5 push. Flash excels at complex and robust animations. Is it possible to create the same effects using only HTML5/JS/CSS today? I found this...

How can I know in Javascript if character is part of alphabet (not just English alphabet)?

I need to analyze pressed key if it is alphabet (for all languages) in UTF-8 encoding. Is that possbile in anyway? ...

How to build a web crawler to find a specific advert, which is in an iframe loaded by Javascript

I'm trying to find all instances of an advert on a website. The advert is in an iframe which is loaded by javascript (it doesn't appear at all if javascript is turned off). Detecting the advert itself is extremely simple, both the name of the flash file and the target of the href always contain a certain string. What would be the best "...

i want on button click browse files without using the fileuploader

i want on button click browse files without using the fileuploader ...

autocomplete in YUI is very slow in IE6 on large dataset

Trying to use autocomplete functionality of YUI, we ran into the fact that it's extremely slow on IE6 for a datasource containing 30000 items (when trying to type in an autocomplete field, it takes several MINUTES for IE to respond). However, the same exact code works pretty much real-time in IE8. Are we doing something wrong? Can we ...

$("#but0_0").attr(...) works but $(hid).attr(...) does not work when hid === "#but0_0"

On Safari 4.0, I have a check that prints "????" if hid === "#but0_0" Works: $("#but0_0").attr("onmousedown",function(){alert("Aha!");}); Doesn't work: var id = "but"+y+"_"+x; var hid = "#"+id; if (hid === "#but0_0") console.debug("????"); $(hid).attr("onmousedown",function(){alert("Aha!");}); The console shows "????" so the code ...

Where can I find advanced jQuery/JavaScript resources/tutorials?

I'm reading some tutorials now about jQuery.. function creating,plugin creation etc. but these tutorials are missing some basic explanations like they mention things like function prototype, anonymous functions, umm putting (jQuery) after the }); .. and stuff like that .. is there a tutorial/website/book that explain these I'm not sure...

resizing text of whole document using jquery

i want to resize the font of all elements of a page like user can click increaseFont or decreaseFont this will decrease the fonts of all elems iam doing doing as writen below please suggest some better way $.fn.ChangeFont=function(ratio) { return this.each(function(){ var _elm=$(this); var currFontSize = _elm.css('fontSize'); var final...

How can I get IE to recognize NBSP as NBSP instead of a space?

For the following JavaScript: function EscapedString(str) { var obj = document.createElement("span"); obj.innerHTML = str; return "&#" + (obj.textContent || obj.innerText).charCodeAt(0) + ";"; } alert(EscapedString(" ")); alert(EscapedString(" ")); alert(EscapedString("\xA0")); IE returns   for each value instead ...

Canceling event bubbling on specific elements - javascript

Basically, I want to make clicking anywhere on a page except in an input field and on one block level element (an by extension all children there in) erase said input field. So I put an onclick event on the whole document. To keep the conditions above I put conditions before the clear instructions to only do it if the event did not ari...

content in tooltip

Hi, I have tooltip(prototip, but it doesnt matter) on my page in javascript and I want when user move on word, where is tooltip, generate tooltip content with string from my proxy-server...so probably when I move on word where is tooltip, javascript send request on proxy server and get response with string content - from this response ja...

Uncaught TypeError: Object #<a Document> has no method 'write' ???

When trying to include google visualization api into a page on google app engine, getting this error in the developer tools console in Chrome: Uncaught TypeError: Object # has no method 'write' In FF 3.5 the error is "n.write is not a function". A bit of a noob here and have no clue how to troubleshoot this. Any ideas? Code can be foun...

window.location Does Not Work on Chrome Browser

I have a javascript function that uses window.location. It works fine in Firefox and internet Explorer, but not in Chrome. I've tested this on both Ubunutu Hardy and Windows Vista. What is the underlying problem, and how can I circumvent it? ...

Erlang shell from a browser?

I have an erlang app with a web frontend. Right now, if you want to talk to it via the shell, you have to do it from the command line. This app will be running on multiple platforms and in environments where the administrator may not be very command-line savvy, but for tech support purposes I'd like to be able to have them bring up a she...

Boost Regex Find host/domain name

hello. I'm very new to c++ and boost. I'm trying to get the host name of a given url: this is what I have now: int main() { string url = "http://www.amazon.com/gp/product/blabla"; //Regular Expression from Javascript. boost::regex ex("/^((\w+):\/\/\/?)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#;\|]+)?([;\|])?([^\?#]+)?\??([^#]...

Use javascript to randomly append CSS class to one list item

Hey, I don't have any code because I don't know how to do this. I'm looking to use jQuery / javascript to randomly append the CSS class "active" to one list item within a an unordered list id'd as ul#sliding_panels. ...

Need Fancybox with image rollover behavior

Hi All, I'm using Fancybox and want to use a rollover behavior when the pointer is moved over the image. See the link of what i have working: http://hayes-studio.com/fancybox_rollover1.html My problem is that i need the rollover image to appear in the correct position relative to the layer .The image on the right is in the layer... y...

Overriding native function?

The native document.createElement() is silly-stupid (it takes only a tag name and no attributes). How come I can't override it? How come this doesn't work? var originalFunction = document.createElement; document.createElement = function(tag, attributes) { var element = originalFunction(tag); if (attributes) { for (var...

validating numbers only and letters only in my textbox

Pleasant day everyone.. i have this java script code in my php file wherein i used this as my validator..for the inputs in different fields in my textbox... my only problem is i don't know how to create a validation that only accepts letters... in my first name and last name field ...looking forward for any assistance thanks have a nice ...