javascript

File upload progress bar

Can anyone suggest a good and easy way to include the file upload progress bar, while uploading a file. I know it would be a mix of javascript & php. Please suggest one ...

chrome and javascript: onclick issues

i am on a pc using javascript and chrome. the issue is the following <a href="#" onClick="classClick(event,1)"This is not working in chrome, but is working perfeclty in FF. I tried "onChange" as was recommended by some results on a search, but still no luck. Any hints? ...

jQuery, show all elements by class name

I want to show all elements with some class name (string). Something like: var somevar = "apple" $( .... select all elements with class == somevar ).show(); How can it be done? ...

javascript window size breaks during startup

I use the following code to get the window width and height function pageWidth() { return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null; } function pageHeight() { r...

JavaScript: remove insignificant trailing zeros from a number?

Have I missed a standard API call that removes trailing insignificant zeros from a number? Ex. var x = 1.234000 // to become 1.234; var y = 1.234001; // stays 1.234001 Number.toFixed() and Number.toPrecision() are not quite what I'm looking for. ...

Framework Brainstorm

Hello All. So we are this company with currently 3 browser based games. We are just 4-5 coders employed and would really like to improve the synergy from our coding. So we are considering making a more generic framework. Currently our games consists of one big mix of html, php, javascript, css & flash (+databases). So basically I woul...

Disabling forms with javascript on submit to prevent double submit

I'd like to disable a form after it is submitted in order to prevent double submissions. Pretty standard use case I would think, but all of the examples I can find out there are flawed. Everything I can find is based on disabling the submit button, but this doesn't prevent the form from being re-submitted if the user hits the enter key ...

Simple parsing questions using PEG.js - newbie warning!

I'm a newbie at Stackoverflow as well as PEG (http://en.wikipedia.org/wiki/Parsing_expression_grammar), so please be gentle! [As a newbie, I was only allowed one hyperlink. Sorry!] I'm trying to wrap my head around PEG by entering simple grammars into the PEG.js playground. Example 1: Input: "abcdef1234567ghijklmn8901opqrs" Desired o...

Are there any ORM frameworks for Web SQL (javascript)?

Anyone knows if there's one available now or will be in a near future? ...

how can i do jquery's $.get in pure javascript? (without wanting to return anything)

I want the mobile version of my site to be as snappy as possible, however i still want some basic analytics. I want to ping a php file (hit counter) after the mobile page has loaded to count the amount of hits from javascript enabled browsers. Jquery's a bit overkill for 1 ajax function so i'm keen to learn how to do the following in p...

Hide menu item or dropdown menu item?

I have dropdown menu item ("pin this site") that i need to hide it or hide menu item itself ("My Network"). When I saw viewsource on page, I got below code. <a class="zz1_TopNavigationMenu_1 ms-topnav zz1_TopNavigationMenu_3 ms-topnavselected zz1_TopNavigationMenu_9" href="http://mynetworkqa.spe.org" style="border-style:none;font-...

How can I create an html input text area such that I can underline or format certain words?

I'd like an input field that I can have javascript set certain attributes for, for different parts of the input field. A simple example to demonstrate what I'd like to do: let's say I want to underline all curse words in an input text area. So the javascript would check the input text area when a new letter is inserted, and for any word...

What is the safest way of passing arguments from server-side PHP to client-size JavaScript

Hello, In my application I rely heavily on JavaScript to enhance the user interface, but all of the data comes from a database and is processed by PHP. By default I use 'echo' statements to substitute the required values "just in time" like so: var myVariable = <?php echo $myVariableInPHP ?> This, however, does not strike me as very ...

How to properly destroy CKeditor instance.

I am running CKeditor 3.4 on a pretty simple page. I am having a problem (sometimes) where when I call document.main_form.submit(), it will not send along the contents of the textarea. After some reading, it sounds like CKeditor is not destroying properly. I tried to manually destroy it before I save the form, but wasn't able to call it....

Invoking function in iframe on same-domain, supporting Internet Explorer

I have an event on the parent page that triggers a javascript function, which in turn calls another function on the child iframe. Both pages are in the same domain and I have verified this by having javascript display the document.domain in both pages simultaneously. This is what has worked for years, and is suggested in similar topics:...

Callback code seems to run before callback is actually called

This sounds like a weird title and probably not stated too well. But here's the issue. I've got this method being called: function BindFacebookAlbumAndPhotoData() { GetAllFacebookAlbums(userID, accessToken, function(aAlbums) { if (aAlbums === null || aAlbums === undefined) { // TODO: Need to hand...

General Questions About Image Maps

First off, I noticed that you can place the <map> tags anywhere in the document and the image map will work just fine. So, is it common practice for people to put the <map> tags in the <head>, or is it better practice to have it in the <body> immediately following the <img /> it corresponds to? Second, I know the map tags aren't depreca...

Ajax and JSON response bug in Internet Explorer (works in all other browsers)

For some reason IE is asking us to download a file instead of running it as ajax. This works in all browsers except IE. I tried messing with the headers that it returns with no luck. The function grabs form data then post's it the response is a can be an array of any number of items to be updated on the page. Its not suppose to be fi...

HTML5 Canvas: Mouse and polygon collision detection

So I'm making a tower defense game with HTML5 and Javascript. My sole problem is detecting when the mouse comes in contact with the attacker's pathway, which is necessary in order to stop the player from building towers on the path. The path of the attackers is determined in the MAP.js file (see the link at the bottom), by a two dimensio...

Combining document ready scripts?

Hello, I'm using a simple show-hide script on various IDs. The issue is as it stands right now each is a seperate JS that calls the document ready function via jQuery. Is there a way to combine this into one more flexible script or at least into one script in some form or another. Thank you so much for your time in advance! Below is a...