javascript

how could i get the node that is calling my function?

I got some javascript inside document.body that is calling a function. Now i'm askin myself, if it is possible(within the function), to get that calling domnode, without passing it to the function? ...

Upload Validation for photos

I got a javascript code like this to validate the file extension for my users when they upload pics on my server.It should allow both .jpg and .jpeg photos however only .jpg files are accepted and it invalidates if the photo ends with .jpeg.Here's the code: function validate(x) { var extensions = new Array("jpg", "jpeg"); var p...

Javascript not-well formed error in for loop

I copied this code from an example. I've read it 100 times. Array.prototype.map = function(fn) { var r = []; var l = this.length; for(var i = 0; i < l; i++) { r.push(fn(this[i])); } return r; }; Why does Firefox say: not well-formed file:///some/path.html Line: 5 for(var i = 0; ...

Whats the most impressive thing you've seen done with JavaScript?

I've realised that while JavaScript has a bad reputation, its actually a surprisingly powerful client-side language - the trouble is that the overwhelming majority of JavaScript written is quirky drop-down menus or form validation. So called "Rich" client side platforms such as Flash and Silverlight are all about glitz and impressive ...

How to change Image Loading Order (for Lightbox)

I've got a page with a lot of images (thumbnails). You should be able to expand the images via Lightbox. I need to encourage the browser to load the image in the Lightbox before any other image (thumbnail). I remember some articles (I can't find anymore) on how to influence the loading mechanism of the browser (use a different subdomain...

Minimum iframe size to avoid scrollbar?

I'm trying to display an iframe, which can be pointed to various urls, and would like to dynamically resize it to display its contents without a scrollbar. How can I find those dimensions? ...

Javascript regular expression not working in Firefox

This regular expression fails in Firefox but works in IE. function validate(x) { return /.(jpeg|jpg)$/ig.test(x); } Can anybody explain why? ...

Resizing a div to fill the browser

Hi, I have a page with many divs and style, with my div buried somewhere inside. I am trying to have a button that automatically makes my div, that includes a video player, resize and capture the whole browser. In order to do that I am trying to get the current position of the div and then position it relatively so that it'll get to t...

jQuery ID Selection dynamic

Not Sure if this can be done, the way I am approaching it. Here goes nothing. I am echoing images from a php upload script, each img has a unique ID which starts at A1,A2,A3,A4 and so on. Now I can select That img ID and create the action I want, however I have to do it for every ID, I wont be able to do this as new ones are created, How...

Eclipse jQuery, Javascript helper plugin?

Is there such a plugin available for Eclipse? Able to assiste with Javascript programming and click on function to go to function? ...

Eval or load a remote script several times

Is it possible to load a remote script and have it eval'ed? For example: $(someelement).update("<script type='text/javascript' src='/otherscript.js'>"); And in otherscript.js: alert('hi!'); That doesn't work. I want to load that script each time the user clicks something. I guess another option would be to put the contents of that...

jQuery walkthrough plugin

Is there a plugin that can help create javascript app/site walkthroughs? If not, (I can't find any via google, though I could've sworn I knew of at least one), is it a good idea (for a moderately complex app)? How does it compare to screencasts? What are some best practice if you were to do one? And in general terms, what are some ideas...

Control Flash movie from JavaScript

Is it possible to control a Flash movie from JS when you have no control over the source? I have decompiled the movie to see its inner workings, but I know nothing about Flash, so I'm mostly in the dark. I found this resource, Interaction with JavaScript, but it's not working for me (probably because I don't know what message to send t...

Tabbing in PHP?

i have these kind of tabs on my page Equ | Tax | Balanced | Debt | Funds | ETF | Gilt ....... and then there's space below these tabs. When user clicks on these tabs then a data corresponding to these tabs has to be displayed in that space without changing the url of the page.Like when i click Equ then its data will be displayed in...

Javascript image "onabort" event not firing in Firefox & Chrome

I'm trying to work out how to get the onabort event of an image element to work. From reading the docs it's meant to fire when a loading page is stopped either from clicking the stop button or firing the stop event. I can get the following code snippet to work in IE but not in any of the other browsers. What am I doing wrong? <html> <...

How to Insert an incremental variable with Javascript/Jquery?

This, I'm sure is a pretty basic question about JavaScript, so apologies in advance. I have simple unordered list: <ul> <li><a href="">Item number 1</a></li> <li><a href="">Item number 2</a></li> <li><a href="">Item number 3</a></li> <li><a href="">Item number 4</a></li> <li><a href="">Item number 5</a></li> </ul> How...

Calling Math Editor (CLOSED)

Hi all... Is there is a library for invoking math symbols/formula(not sure what to call), which are design specifically to be added in a websites called maybe in html, php or javascript code. Just like the button for bold, italic, link, etc. above the textarea in answer/ask ques page(sorry bout earlier), there will be another icon to ...

Javascript event when mouse leaves browser window

I'd like some Javascript code to run when the mouse leaves the browser window. I only need to support Safari (WebKit.) I tried putting a mouseout handler on window. That handler is reliably called when the mouse leaves the browser window. But because of bubbling it is also called when the mouse moves between elements in the document. I ...

Google Chrome breaks network connection when JavaScript errors

I have this strangest problem and I can't debug it. I am writing a heavy JavaScript application, which spawns a popup when user uploads a file. The actual file transfer happens in the popup, which is set to be the FORM submit target. Works in all browsers, there are no javascript errors. However, in Google's Chrome browser, when form i...

Is it possible to create client-side only mashups with javascript?

Hi everyone I have been tinkering with javasript (jquery) all day. I want to create a personal little mashup that grabs the page contents of a few local music venues, reformats their data, and presents in a single webpage. I thought I could be clever and load them as iframes, hide the iframes, and access their contents through the DO...