javascript

cross domain XMLHttprequest

Here is my situation: I have a Webserver machine, Client machine, and a third machine running some program that listens for XMLHttpRequests. Client accesses the Webserver from the Client machine, makes some changes, and then clicks on'Save'. At this point, data is being sent back to the Webserver and to the Third machine. All of this i...

CRC-CCITT (XModem) implementation in javascript

Hi, i'm trying to implement a CRC-CCITT (XModem) check in javascript without success. I need it in order to send socket string into a controller via RS232. does anyone know how to do it? or perhaps is there a sample code somewhere?? I would appreciate any kind of help :) ...

Changing height of a div - Firefox and IE?

Hey all - I have a fixed size div with another div inside that holds Flash at 100%. I need to change the height of the fixed div on the fly. This works in Safari, but not on FF or any Windows browsers <div id="center1200"> <div id="content"> </div> </div> and I call with jQuery $("#center1200").height(1000); ...

Getting options text value in Java

How I can get select option text value in Java? Select options are in javascript. <select id="colors" name="colorselector" > <option value="red"> Red </option> <option value="blue"> Blue </option> <option value="orange"> Orange </option> <option value="blue"> Yellow </option> </select> ...

How do I remove a file from the FileList

I'm building a drag-and-drop-to-upload web application using HTML5, and I'm dropping the files onto a div and of course fetching the dataTransfer object, which gives me the FileList. Now I want to remove some of the files, but I don't know how, or if it's even possible. Preferably I'd like to just delete them from the FileList; I've g...

Remove background image on image load

I'm loading image tags via AJAX and inserting them with the conventional .html(content) function in jQuery alongside a bunch of other HTML. However, this question still applies if you're loading a page from scratch. Now, I have a background image placeholder to be put there while the image loads. I want this background image to go away w...

Javascript: find the time left in a setTimeout()?

I'm writing some Javascript that interacts with library code that I don't own, and can't (reasonably) change. It creates Javascript timeouts used for showing the next question in a series of time-limited questions. This isn't real code because it is obfuscated beyond all hope. Here's what the library is doing: .... // setup a timeout...

Looping through data in Javascript, combining new id's with old.

Many times I'm having to loop through data and add the new to the old, but I can never seem to get it right.. Here's what I have now, basically trying to concatinate together the previous number from the new number, ultimately building a comma delimited string of numbers: function showItems(){ if(prev_numbers == ...

Character Counter Super Slow - jQuery

I wrote this: $('[name=item-title]').live('keyup',function(k){ char_limit=parseInt($('[data-charlimit]').attr('data-charlimit')); total = char_limit-parseInt($(this).val().length); $('.charcount span').text(char_limit-parseInt($(this).val().length)); }); But after the first few words it starts going super slow where I'll t...

GridView with checkbox column. Client-side script to uncheck all except current checkbox

Hi I am dynamically binding a typed list to a GridView control. The Grid View Control is in an asp.net page that is wrapped in an asp:UpdatePanel (Ajax). The first column contains a checkbox control. Only one checkbox may be checked in this column. If the user checks a checkbox, all other checkbox must be unchecked. I am trying to a...

What's the best way to coordinate javascript clients to a single backend game?

What's the best method to use to notify javascript client's of changes that occur in a game asynchronously (i.e. moves made by other clients). As an example, assume a turn based board game. Should I just have the client poll the PHP backend every second or so for new moves, or is there a better way to send an asynchronous notification to...

Help! YUI async GET request using HTTPS defaulting to OPTIONS request method

Hi, For some reason whenever I do an async request using YUI and specify it to be a GET or POST, and the request is HTTPS, the actual request comes through with the OPTIONS request method. help! why is it doing this? P.S. I tried this with Prototype and got the same deal. ...

Creating a pop-in window effect with hashtags

I'm creating a script that allows me to launch pop-in windows based on the URL's hashtag. I'm able to get it to work when the user plugs in the URL+hash directly in the location bar. However, when the anchor links are clicked, the script doesn't seem to perform the .load() function. Is my sequencing wrong, or am I going about this the co...

Convert integer into its character equivilent in Javascript

I want to convert an integer into its character equivalent based on the alphabet. For example: 0 => a 1 => b 2 => c 3 => d etc. I could build an array and just look it up when I need it but I'm wondering if there's a built in function to do this for me? All the examples i've found via Google are working with ASCII values and not a cha...

Implementing right click on Flash, using Flash Builder.

Hi guys. Some days ago, I saw this very interesting post: http://www.uza.lt/blog/2007/08/solved-right-click-in-as3/ and now, I'm sure that a custom right click can be used in Flash, throught JS. The problem is.. that the guy who coded that, he used a "custom" swfobject (or older, dont know) and a "custom" index.template.html. The pr...

Using a large image (file size) but not hinder load time?

My demo is here. Basically, I have a HUGE image (19160px × 512px to be exact, just under 2MB) that I transition the backgroundx using javascript to make it appear as if a transformation was happening. I cannot compress the image much more without ruining its quality dramatically. Is there another way that I can achieve this with the sa...

How to print the values from datatable(Arraylist) using javascript ?

I have a datatable in a JSP page and a print button. On click of the print button it will open the print option dialog and print the datatable values. Now, I have button onclick="callsubmit()". javascript: function callsubmit(){ window.print(); window.opener.document.location = window.opener.document.location.href; window....

Pausing until a callback is called, in Javascript

I'm fairly new to the callback-style of programming in javascript. Is there a way to force code to wait until a function call finishes via a callback? Let me explain. The following function takes a number and returns a result based upon it. function get_expensive_thing(n) { return fetch_from_disk(n); } So far, easy enough. But what ...

How do I store my websites header and footer in one location?

I am always rewriting my headers and footers and for every edit i have to manually copy and paste all the code into the web pages. Obviously this is the wrong approach but im not sure of the right one. My current idea is to have a "header" and "footer" div and then with jquery's $(document).ready load the divs with code. Im afraid it wil...

Converting UTS (UTC-0) times to BST in PHP or jQuery

I'm pulling the most recent listened tracks from last.fm and putting them on my website. Problem is, the times are retrieved in UTC-0 uts format and appear to be an hour out when comparing them to BST times in order to calculate a fuzzy time stamp ("about 5mins ago", "about an hour ago" etc). Is there any way solve this so the times al...