javascript

Background music for a web page game

I am making a game in an HTML web page. How would I add music to this game? ...

How do I upload a file when I know the client's filepath?

I'm interested in the way Sonic Living detects your iTunes library XML file. It prompts the user to approve its actions, then automatically uploads the XML file based on the client OS (and assuming the default installation path of iTunes). How the heck does it do that? None of the upload libraries I've looked at have this feature. They ...

YUI2.8: How to target element with handler applied only.

Hi, I'm having some probs with event propagation, I understand the concept, but I don't understand how to squash the default YUI behaviour. I have this markup: [divElement id="container"][imageElement ... /][/divElement] I have added a click event to the container element like so: ye.on(yd.get('container'), 'click', function(el){ // d...

Javascript library to reliably delay-load java applets

I'd like to delay-load a Java Applet in the same way that SwfObject loads Flash SWFs-- you supply it a div id and it replaces the div's contents. This would allow the whole page to load before the Applet starts. However, I'd also like to use a best-practices Javascript library like deployJava.js or applet-fu. The problem with these li...

odd behavior setting timeouts inside a function with global references in javascript

Here is the the function and the globals: $note_instance = Array(); $note_count = 0; function create(text){ count = $note_count++; time = 5000; $note_instance[count] = $notifications.notify("create", text); setTimeout(function(){ $note_instance[count].close() }, time); ...

Javascript object properties access functions in parent constructor?

So I'm using this pretty standard jquery plugin pattern whereby you can grab an api after applying the jquery function to a specific instance. This API is essentially a javascript object with a bunch of methods and data. So I wanted to essentially create some private internal methods for the object only to manipulate data etc, which ju...

Understanding prototype method calls

In trying to call a method on the CodeMirror javascript code editor. I'm new to javascript and trying to understand how object oriented stuff works. I'm having problems calling what I believe are methods. For instance, var editor = CodeMirror.fromTextArea('code', options); editor.grabKeys(function(e) { alert("Key event");}); This g...

Including javascript files from other projects inside the same solution

I have a project called WebResources where I have all the JS files that I intend to use in 2 other projects (all three projects sit in the same solution). I just spent 2 hours playing around with the file paths and VS just doesn't see the JS file (unless I specify the full path with the drive letter). Is there a trick to including javas...

How can the javascript plugin architecture in raphael/jquery be done?

I'm looking for a barebones javascript example that demonstrates how the javascript plugin architecture works with large javascript libraries (such as raphael or jquery). In either scenario, you build plugins by ensuring your custom plugin follows this pattern: jQuery.fn.pluginName -- so assume I have a library: myLibrary = (function() ...

Hiding Text in ie7

So I have this text generated by a javascript plugin. <a class="className">Text</a> a.className { background: url(images/a-image.png) no-repeat; } But the "Text" shows on top of the image... Now... with any respectable web browser, I can use color: rgba(0,0,0,0); to solve the problem, but IE7 doesn't obey standards of any sort. Any...

Removing unused selectors in a CSS stylesheet?

I've been developing a web app for a few weeks now and ended up with about a 1000 lines. I am sure not all the selectors are being used and am trying to clean it up. At the same time, I don't want to do it manually for obvious reasons. Is there a safe and an efficient way to remove unused selectors? For this, am I supposed to navigate ...

jQuery: Preventing list scroll?

I have this scenario: Using an ajax query I fetch some data items and push them into a ul element as an li element. I use $("ulele").append(new_li_item). I wrote my own custom scroll for this ul element using the following whenever an event is detected: $("ulele").animate({scrollTop: '+=' + 200}, 'slow'); The problem is when I fire th...

how to make secure sign up form

i want my sign up form to be secure from hacker..i want all secret information can't easily open by wrong people.. i wan't some data become encrypted.. how to make it?? ...

How to implement animation between pages

I have been advised here not to create a single page website. However, I would like to create animation effects between tabs like this one. How this can be done if I have a separate HTML for each tab ? Or maybe you have a better approach... ...

Sort ListBox items using Javascript/Jquery

Hi all I have a Listbox with some items on a page. Is there any simple way to sort the items using Jquery or native javascript? Best Regards, ...

Undefined variable error when parsing json

I'm trying to parse the json grabbed from here. Basically what I do is iterate over the items, sort them, then display them. But I get an error saying data.data.children[i] is undefined. I can't think why it's doing it though? var json = 'http://www.reddit.com/reddits/mine/.json'; GM_xmlhttpRequest({ method: "GET", url: jso...

Cross Domain RSS (XML) Client Side Only Solution?

Assuming my conditions for building a RSS feed reader were I had to provide only a Javascript snippet. The RSS is cross domain and is only XML. What are my options and how can I implement them? thanks ...

show data from database in table format inside form

I have an input form connected to a database. After [the form is submitted], I want to make a form to show all the data which has been input to the database. I want to show this data in table sortable by name or date. Please help me. ...

How to implement something like PHP's http_build_query and the reverse in javascript?

<?php $data = array('foo'=>'bar', 'baz'=>'boom', 'cow'=>'milk', 'php'=>'hypertext processor'); echo http_build_query($data); /* Output: foo=bar&baz=boom&cow=milk&php=hypertext+processor */ How to do similar thing in javascript,say, get the query string from the array ,and convert the arr...

disable javascript popup on refreshing page

Hi all, I have written code like this to throw a pop up when my website is closed. But this throws the pop up even if i refresh my page. Please help me to throw popup only when i close the browser of that website. (disable popup on refreshing page) <body onunload="javascript: exitpop()"> <script type="text/javascript"> function exitpop...