javascript

Mode7-like perspective transform in canvas?

I'm making a canvas-based game engine and am wondering if anyone has any good info on how to achieve an overhead view perspective. What I'm looking for is somewhere halfway between the traditional birds eye view and the old SNES mode7 view. Just a slight angle to give the illusion of 3D. I'm trying to figure out what is going to be the ...

CSS Block for Employee Entry Form

Hello I am creating a simple form to enter employee information. An employee has the following characteristics: First Name Last Name Age SSN Gender Race etc... There are about 20 properties I want to display a label and textbox for (some have dropdowns). I don't want to use a table because I've read that using <div> elements and CSS ...

Using ANTLR to parse JavaDoc comments

I'm attempting to parse one particular (home grown) JavaDoc tag in my JavaScript file and I'm struggling to understand how I can achieve this. Antlr is complaining as documented below: jsDocComment : '/**' (importJsDocCommand | ~('*/'))* '*/' <== See note 1 ; importJsDocCommand : '@import' gav ; gav : gavGroup ':...

jQuery Validation Plugin Multiple Checkboxes

I am having some difficulty in using the jQuery Validator plugin. I have a list of checkboxes with different name attributes and I can't seem to figure out how to ensure that at least one of them has been checked. Everything that I find on Google seems to only work when the name attribute is the same. Here is some sample code (updated...

Best way to open, and write (save) content in an iframe

I would like to know the best method to open an html file to an iframe that has document.designMode="on" functionality, and then save any edits to this html file (essentially an open and save method for the Mozilla Midas spec) I only would like to use javascript or PHP moz midas spec I am very new to javascript so please excuse me if...

Is there any way to do an AJAX call to a file above public_html?

I'm making a script that lets my users open the page, vote for our site, and then get a password to some restricted content on the site. However, I plan on storing the password in a file outside public_html so it cannot be read directly from the source code. Is there any way to do an AJAX call to a file above public_html? I don't want t...

JS - document.getelementbysrc?

Is it possible to get an element from the value of the "src" attribute? ...

How to use jQuery/Javascript to fadein/out text after a while

On Envylabs' site they have a feature where, below the logo, some text keeps changing after a few seconds. I'm trying to find out what kind of JS/jquery function would do that. Can someone point to a tutorial for this? ...

Avoid Race Condition in Facebook JavaScript API with FB.logout

I am desperately trying to force a logout before a user starts a new facebook session. But before logout is succesfully called, auth.login seems to login the user and I redirect them. So it seems to be a race condition, but I can't figure out how to get around it. FB.init({appId: xxxx, status: true, cookie: true, xfbml: true}); //Tr...

What is the scope of javascript callback and anonymous functions?

I have written the following code using node.js and riak-js. I have a recursive function walk that should be a list of JSON documents, but instead returns an empty list... why? how to fix? require('riak-js'); var walk = function(bucket, key, list){ if(list == undefined){ var list = new Array(); } db.get(bucket, key)(functi...

How to find window restore in Javascript

Hi, How to find the window state using javascript.Consider our application need to alert('restor') when browser unmaximize and also need to alert('maximized') when restore or maximize the browser.Can anybody please help me. ...

Which Anti-XSS library should I use? Microsoft XSS 4.0, Web Protection Library on Codeplex, or other?

Seems like Microsoft updated the Anti XSS library today: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=f4cd231b-7e06-445b-bec7-343e5884e651 In addition there is a new release of the Web Protection Library http://wpl.codeplex.com/ Are these two downloads the same thing? What XSS library should I be using? Are there ot...

How to translate prototype's $A() function into jquery?

Hi chaps, I'm trying to translate Brandon Kelly's AC.VR class (Prototype) into a jQuery plugin. Here is a link to his example (unfortunately just working in Safari). I managed to get the basics working. The problem I'm having is the mouse event history for the velocity, acceleration and friction part of the script. Here is a shorten ...

Mobile Safari/Webkit On Window Focus Event

I am wondering if it is possible to get a event when the user switches back to "your" page's window? This could happen either when the user opens a new tab and then switches back to your page's tab or when the user closes safari and then opens it again. I want to be able to update content on the page once I get this event. I am using a ...

PHP: Display a "loading" page while a php script is executing

Hi All, Here is what I've got right now... I have a web page that when accessed, it connects to surveygizmo.com via their open API, retreives a whole lot of data, and then returns that data to me for processing on my end. This process takes roughly 10-12 seconds and while it is executing, the page just sits in the "loading" state and I...

Do this after visiting X amount of pages on site

Is there an easy way to track how many pages a user on your site has visited with Javascript (preferably jQuery)? I need to execute a function after a user has visited more than 5 pages on the site. I was thinking of storing the window.location.href into a variable and checking it to see if it matches the next page. If it doesn't I wou...

How to set size of a select drop down menu in jquery

The normal way to do this would be: var resultSelect = document.getElementById("resultSelect"); resultSelect.size = 3; How do i do this in jQuery? Thanks in advance ...

Auto fit CSS attribute to textarea

Hi, I am working on web application. I wanted to apply auto height to textarea using CSS, dont want to use any script, jquery plugin and other stuff. After applying class ( i.e. style property ) to textarea, it should automatically increase it's height not width as per content present it in. In this case width should be fixed i.e. w...

Call a function on any event of textarea

Hi folks, I wanted to call a signle function on any event happens for <textarea>. How do I achieves this. Please do suggest me folks, jquery is preferable. Thanks, -Pravin ...

Variables in URI for jQuery / Javascript

I'm sure this is a very dumb question, but I haven't been able to find any good explanations regarding what I am confused about. When using a CDN, say, Google for jQuery, how does the version variable work in the URI? Yes, I understand how $_GET works in PHP, but how does this work for a non-server-side script? Thanks in advance. ...