javascript

List files in a directory using only javascript

Is it possible to list the files in a directory using only javascript? To clarify, I mean list the files on the server, not the files on the clients computer. For instance: www.domain.com/files/ contains 4 images (.jpg) Can I make an extra page (www.domain.com/files/list.html) that lists those 4 files using javascript? ...

exit from click handler

How do you exit from an event? $('.more').click(function() { if (condition1) { if (condition2) { // abort, exit completely out of click handler ... ...

send different object value to different funtions

I have the code below. I want to send the value of value1 n.value1s = new Array(); n.value1sIDs = new Array(); n.value1sNames = new Array(); n.value1sColors = new Array(); n.descriptions = new Array(); to pg.loadLinkedvalue1s(n); and for value2 to pg.loadLinkedvalue2s(n); Howd I do that in javascript without haveing ...

efficiency of jquery toggler

Here's the link to my code: http://jsbin.com/edago3/edit I would love to find out what improvements could be made to make it smaller and more efficient. Any help is appreciated. ...

[JavaScript] Define associative array of arrays

Hello, I want to define an associative array like this var = [ { "100", [0, 1, 2] }, { "101", [3, 4, 5] } ] Essentially I want to be able to access an array of three numbers by specifying the custom index. However, no matter what I try I cannot make it work. I know I can define it as: var["100"] = [0, 1, 2]; var["101"] = [1, 2...

jQuery equivalent of getting the context of a Canvas

I have the following working code: ctx = document.getElementById("canvas").getContext('2d'); Is there any way to re-write it to use $? Doing this fails: ctx = $("#canvas").getContext('2d'); ...

ASP.NET javascript. Put it in code behind or put it in .aspx file?

Why do people put javascript in the code behind ? I think it is ugly to have 100 (see below) of these.... Is there some basic reasons that javascript must be in the code behind in some instances? And when it should in the aspx. ?? // now we gotta recalc fields szCalcBenefitsTotal += " CalcCostFrom...

how to use js with my server date and time

i want my server time and date to be set as new date i have tried this: dateNow = new Date("<%=now()%>"); but this is not working how can i do this? here is the code that give me the problem... it is just get stack on the time diff and doesn't countdown <script type="text/javascript"> dateFuture = new Date(<%=year(privatesellstar...

Extract information from javascript counter via PHP

Hi, I'm looking for a way to extract some information from this site via PHP: http://www.mycitydeal.co.uk/deals/london There ist a counter where the time left is displayed, but the information is within the JavaScript. Since I'm really a JavaScript rookie, I didn't really know how to get the information. Normally I would extract the ...

AJAX works fine in firefox, but malfunctions in Mozilla Prism 0.9

I have the following ajax fucntion: function ajax(value, url, urlVarname, displayContainers_id){ if(value == ''){ document.getElementById(displayContainers_id).innerHTML=''; } /* THIS IS LINE 12*/ xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState == 4 &&...

How can I prevent javascript errors in my selenium tests from hanging my build system?

We are having a problem with our selenium tests which run in IE on a virtual machine. Whenever there is a javascript error, a popup shows up and puts our system into a 'stuck' state - a user has to go clear that and restart the selenium test run. Is there a way to prevent the javascript error popup from putting the system into its stuck ...

JavaScript reverse DNS look-up

Is there a way to display the reverse DNS entry for someone visiting your page using only JavaScript? Or is the only way to do an AJAX request to a server that can do it? ...

Multiple ASP.Net Controls On One Page

We have created a User Control for ASP.Net. At any one time, a user's profile page could contain between one and infinity of these controls. The Control.ascx file contains quite a bit of javascript. When the control is rendered by .Net to HTML, you notice that it prints the javascript for each control. This was expected. I'd like to red...

Javascript: s/digit/" " x that digit/g

I would like to match a digit and replace it with that many spaces. Can this be done in less than 9 lines of code? Example "asnthsnth4nts4h3n" --> "asnthsnth nts h n" ...

HTML wrapper div over embedded flash object cannot be "clickable" by jQuery

Hi all: I've been trying to do as the client requested : redirect to campaign page then to destination page once a customer clicks on the top banner in swf format. You can check what's been done at :http://ausdcf.org If you are using Firefox, Chrome or Safari, I suspect you can reach the destination page. However, if you are using IE...

How can I edit on my server files without restarting nodejs when i want to see the changes?

I'm trying to setup my own nodejs server, but I'm having a problem. I can't figure out how to see my edited files without restarting nodejs. Is there a way to edit file live with nodejs? ...

Using jQuery tools from within GWT -- is there a way to allow exchanges?

I have a GWT web-app with a nearly full page Google map window. Inside the the map, I have infowindows which include links. What I want to do is use jquery tools overlays (http://flowplayer.org/tools/overlay/apple.html) to open the overlay and display it on top of the map once the link inside the info window is clicked. Now, the link...

javascript setTimeout function out of scope.

I am trying to call showUpload(); from within two setTimeouts. Neither works. It seems to be out of scope and I'm not sure why. I tried this.showUpload() which didn't work either. $(document).ready(function(){ var progress_key = $('#progress_key').val(); // this sets up the progress bar $('#uploadfo...

jQuery: How to fire event when all asynchronous calls return?

I have a jQuery application that loads data from five asynchronous server calls. I do not want to display any data until all five calls return. (I plan on displaying a Loading message until that happens.) How can I detect when all five calls have returned? I considered having each callback method increment a variable (using jQuery's dat...

Best way to structure AJAX for a Zend Framework application

Sorry, but there's a lot of outdated and just plain bad information for Zend Framework, since it has changed so much over the years and is so flexible. I thought of having an AJAX module service layer, with controllers and actions that interact with my model. Easy, but not very extensible and would violate DRY. If I change the logisti...