javascript

Attach an onload handler on a window opened by Javascript

I want to be able to know when a user navigates away from the page I have loaded in a window opened by Javascript. For example if I have: newWindow = window.open('http://www.example.com', 'testWindow'); I want to know when the user navigates away from that page (so unload, onunload, onbeforeunload would all work for me if any could be...

Multiple IF's and ELSE IF's in javascript

Hey guys, So what's getting pushed to this array is dependant on a few radio boxes. I've got this for standard and wheelchair seats: if(document.getElementById('standardseat').checked) { //Standard seat is checked seatsArray.push(e.posX, e.posY); } else if(document.getElementById('wheelchairseat').checked) { //Wheelchair seat is ch...

A JavaScript alert or dialog with a combo box

This looks fairly simple, but 30 minutes of googling took me nowhere. :-( How do I create a simple JavaScript dialog / alert with a combo box so my user can select a value before submitting? I am using this for a rejection reason so user clicks on reject button and must select a reason from a combo box inside an alert / dialog popup win...

In Javascript, why write "var QueryStringToHash = function QueryStringToHash (query) { ... }" ?

In Javascript, I have seen var QueryStringToHash = function QueryStringToHash (query) { ... } What is the reason of writing that instead of just function QueryStringToHash(query) { ... } ? This comes from the answer in http://stackoverflow.com/questions/1131630/javascript-jquery-param-inverse-function ...

A JavaScript alert or dialog with a TextArea instead of TextField

var msg = prompt("Type something:") is very useful but it uses a TextField. I would like to have a TextArea instead, so the user can type and see a bigger message. Is it rocket science? Probably not but google did not help. I wish I was a front end guy. :-) Thanks! ...

Dynamically adding a large number of images to a page, loading in the background

I am dynamically adding a relatively large number of small images to a page. I make a XMLHTTP request which returns some JSON data of the form {images:[ {url:'/image?id=1', width:32, height:32, label:"Foo"}, {url:'/image?id=2', width:32, height:32, label:"Bar"}, .... ]} I then construct some HTML of the form <ul> ...

looking for suggestions on how i can highlight areas on an image

i am building a workout website that tracks exercises. Each exercise has a mapping to a certain part of the body (bench press --> Chest) I am trying to figure out a way to visualize this and i thought of the idea of putting an image of a person "highlighting" the affected muscles. Sort of like This: Assuming i have found a good pic...

ExtJS grid problem with html

I have an ExtJS grid connected to a store. When I add a thumbnail column with an <img> tag inside store, grid shows 0. Is there some kind of html filtering? If I change the store data to something without html tags it shows fine. Excuse my awful English and thanks in advance. ...

Javascript bitshift alternative to math.round

var1=anyInteger var2=anyInteger (Math.round(var1/var2)*var2) What would be the syntax for JavaScripts bitshift alternative for the above? Using integer not floating Thank you ...

php + mysql + html + javascript = i18n headache

This has been always a problem for me , Character problem . I always tried to solve my problem with little patches , actually this never solves my problem in reality.So I am looking for very strong solution to solve all these problems.I want to learn how big apps(facebook , google, other multi lingual ajax apps and apis) solve this probl...

How do I call this function that's within a jquery plugin?

I'm using a jquery plugin on my page, vTicker, "for easy and simple vertical news automatic scrolling". I'm using it in combination with an rss jquery plugin. It's working fine, but I need to create a button that will do a manual scroll. Can anyone tell me how to do this? I'm guessing I need to call the moveUp function from the vTicker f...

Events on DOM elements not yet created, in Javascript?

I have a Javascript module the following Javascript: EntryController = function$entry(args) { MainView(); $('#target').click(function() { alert('Handler called!'); }); } MainView() has a callback that creates the #target button. Because of the callback the code will pick up and run through the rest of the code $('...

Any ways to display Google web / custom search results, into another UI?

I have currently a program written in html / javascript related to the Google search API which functions when users search a place, information and local places on it will be returned. Google custom search and web results have a standard "UI" for their results returned. I would like to display them in my personal UI, etc maybe in a drop...

jquery redirect on click or after 10 seconds

Hello, I have a spash screen on a website that has a div with the ID of "splash" i'm trying to make the div fade in then if the user clicks on the div it fades out and redircts to the main site. If the user dosen't click it just fades out and redirects after 10 seconds. The timed redirect is working but not the click function. ...

Can Action Script FileReference object be sent to Javascript and converted to File object ?

In Action Script, FileReference.browse() is called. I would like to send the chosen file to Javascript and convert it to File object, just like if I would press the Browse button of the <input type='file /> and got File object. I need that to be able to display picture thumbnail like shown here. Maybe instead of passing the whole obje...

Can I call other methods in other javascript files from my overlay script?

I am writing a Firefox extension. I have setup an overlay for chrome://browser/content/browser.xul and I am handling the on load event. This I have working. I also have N separate .js files in my extension (specifically in chrome://my-extension/content/js/*.js). Each of these .js files implements a common interface. For example, fo...

Creating Array From Window.location.hash

Hi, i am trying to create array from window.location.hash variable but i am failling. My code is: $.each(window.location.hash.replace("#", "").split("&"), function (i, value) { value = value.split("="); var my_item = {value[0] : value[1]}; form_data[i] = my_item; }); consol...

add function is not working ?

Hi my code is---- what happening is url and id is passed from one function to another but when i clicked on link which contain add(){} function it <a href="#" style="color:#FFF;"onclick="add();" id="cricket" tabindex="1" name="cricket">cricket</a> it doesn't catch the url and id javascript fn is------- var url, id; function addE...

HTML form input tag name element array with JavaScript

This is a two part question. Someone answered a similar question the other day (which also contained info about this type of array in PHP), but I cannot find it. 1.) First off, what is the correct terminology for an array created on the end of the name element of an input tag in a form? <form> <input name="p_id[]" value="0"/> ...

Find mouse position relative to element

I want to make a little painting app using canvas. So I need to find the mouse's position on the canvas. ...