javascript

How to create efficient map system?

Hi, i have a map system (grid) for my website. I have defined 40000 'fields' on a grid. Each field has a XY value (for x(1-200) and y(1-200)) and a unique identifier: fieldid(1-40000). I have a viewable area of 16x9 fields. When the user visits website.com/fieldid/422 it displays 16x9 fields starting with fieldid 422 in the upperleft c...

Page not updating during busy javascript code.

Hi, I have a pretty long javascript script. The problem is that in the middle of it I want to change a div's innerHtml to say "almost done please wait". I think the issue is that I call a jquery function. The in the success callback of the function I call another function which is where I am trying to update the page from. If I set a br...

Performance of dojo (logging, comet, sliders)

I have some performance issues in my JavaScript, and I'm not having much success instrumenting it. One of the things I've tried is using firebug's profile tool. It reports that the top single call was to dojo's log(). Unhelpfully, it reports a line number from the compressed script, so I can't tell what's causing the problem. But it ...

Matching the max numbers of items using regex

I have a string of digits, ex: "1234", and I need to return the largest matched group of digits for each number in a comma-separated list. Searching for "1234" in "1000, 1200, 1330, 1235" would return ["1", "12", "1", "123"] Thanks! ...

Make <tr> to act like <a>

I have a table and I want every row to be clickable. Right now, I'm doing the simple: $('tr').click(...) This works for the most part but how can I make it act like a link in these ways: Shift-click opens the target in a new window Middle clicking opens the target in a new tab Hovering shows the link address in the status bar ...

How can I poll a PHP page using javascript?

Hello, I am sure there is a simple answer to this, but I am drawing a blank at the moment, any suggestions pointers would be great. I have a php page [ lets say counter.php] which when called [loaded/viewed] it connects to a db and increments a counter. I also have another page that has a selects box, I want to add a .js function on the...

Javascript arranaged so that things are OK when there's no Javascript ?

Don't overthink this - there's a very commonly used term and I ... have ... completely ... forgotten ... it ! ;-) What is it called when a web page makes use of Javascript (generally in a sophisticated fashion that adds a significant amount to the functionality of the page) but things are arranged in such a way that if the browser has J...

How to use javascript to determine whether a file exists in a directory?

Hi everyone! How to use javascript to determine whether a file exists in a directory? ...

Simplest way to parse a Date in Javascript

I want to parse a Date chosen by user: var ds = "11 / 08 / 2009"; I use var d = new Date(ds); It gives me November, 08, 2009. But what I need is August, 11, 2009. What is the simplest way to parse the date? ...

How can I access the dom tree of child window?

I open a new window using the following code: purchaseWin = window.open("Purchase.aspx","purchaseWin2", "location=0,status=0,scrollbars=0,width=700,height=400"); I want to access the dom tree of the purchaseWin, e.g. purchaseWin.document.getElementById("tdProduct").innerHTML = "2"; It doesn't work. I can only do this: pur...

ASP.NET/Javascript: Loading huge data in browser

I have this GUI that shows, let's say Customer Orders. When my client nailed down the requirements, he asked me to keep pagination like this, Show Items Per Page : 10/50/150 For each customer there could be thousands of orders and each order will have atleast 50 attributes to show up in the screen. So, assume a 50 column html table...

Logging out after certain amount of time

What would the best way be to logout a user from a PHP application (so basically just perform a redirect) after X seconds of inactivity? For "inactivity" I'd count the time of the last page load, and if the current time is more than X seconds away, perform the redirect. Is this something that would need to be achieved with Javascript? ...

How do I get the whole number portion of a number (javascript)

e.g 1.2=1 1.5=1 1.9=1 ...

Harden url passing to another page using parameter

i want to pass parameter to another page through iframe example <iframe src="http://otherserver.com/page?user=user_id"/&gt; rather than passsing user= id this way, is there any technique so that user will not aware of user=user_id ? ...

GWT conditional compile

I'm using the same source code for a GWT 1.5 and GWT 1.7 application. I'm wondering is there a way to conditionally compile parts of the java code for one or the other version. I know there is a way to do it for widgets and browsers in the module XML file. ...

Javascript DOM created form not working

After searching google for an answer and just starting using javascript I could not figure this one out... I created a form dynamically when onclick a button "Add Record" in a form. the new form is created and assigned to a div, all good. After rendering this form I can't get any of the values in textboxes. while testing I tried man...

ExtJS DateField using different display format

I'm using a ExtJS DateField control in an ASP.NET MVC web application. I've set format property to "Y-m-d", so that it'll correctly parse the "2009-08-11" format from the server, and will also send it back in that format. However, I'd like to display the data in a different, more user-friendly, format, particularly "d mmm yyyy" in Span...

How to pass variables in to a JS file...

I know there's an easy answer to this, but this comes in the form of 2 problems. Problem 1: In an asp.net page there is a javascript block like this: <script type="text/javascript"> function doSomethingRandom() { var myVarToUse = <asp:Literal runat="server" ID="HackyLiteral" /> } </script> Ok, so it's a simplified ve...

Horizontal Scroll Event in FireFox 3.5 Not Firing.

Hi, I've attached a function to the DOMMouseScroll event in FF3.5. The event fires as expected on a vertical scroll, but not on a horizontal scroll. Is this a known bug or a problem with my code? document.addEventListener('DOMMouseScroll', function() { console.log(arguments); }, false); Rich ...

how to access the selectionRange using the onselect event object in textarea

I am working on a project where I will be getting all the events that have occurred in a textarea and give a replay of the events. To fulfill this objective, I am collecting all the events that have occured in a textarea. I am storing the events in an object array containing the event and timestamp. Now for onselect events, how do i get ...