javascript

Strip the last character sent by JavaScript through websockets to Python

I'm currently trying out websockets, creating a client in JavaScript and a server in Python. I'm stuck on a simple problem, though: when I send something from the client to the server it always contains a special ending character, but I don't know how to remove it. I've tried data[:-1] thinking that would get rid of it, but it didn't. ...

How to ensure CSS opacity changes to text/links don't change the color value in Firefox/Windows?

So I noticed that when I do an opacity change to a text or link element in Firefox (3.6+) on Windows, along with an opacity change, the color changes as well. For example, the blue text link shifts to a yellow just before it disappears. Have a look at http://linowski.ca/experiments/onproximity/ and move to and from the text link named ...

Grabbing entry domain for a site.

I have several domains that point to the same site, some of them ending in ".br" (domain for Brazil, thus for portuguese speakers) I want to detect from what domain the person came (.br or not) and load the correct landuage... I can use PHP, JavaScript or standard HTML/CSS etc... How I do it? (and with what?) ...

passing parameters to running silverlight application

The scenario is I have a list of items in HTML; when I click on an item I use JS to dynamically create the HTML to load a silverlight app passing in the specific item # (using initParams); and my silverlight app visualizes this in a nice way. I do this on the same page rather than loading a new webpage, and the transition is smooth. I ...

JQuery wrap() problem

Why doesn't the following code wrap the image with <li> tags and what would be the best way to do this? var i = new Image i.src = '/images/image.jpeg' $(i).wrap('<li />') $('div').html(i) produces: <div><img src="/images/image.jpeg"></div> instead desired: <div><li><img src="/images/image.jpeg"></li></div> ...

plz show me a more elegant way to do this

To me, this is the obvious way to do this. This being : given a start point and an end point, tell me if the end point is up / down / left / upleft / downright... etc of the start point. Heres the core of the logic : function getSector() { var y = startY - endY; var x = startX - endX; var angle = Math.atan2(y,x) * 57.29578;/...

Should I combine javascript into one file, or break it into a few files based on change frequency to minimize invalidating the browser cache?

I'm combining my javascript into MD5-digest-versioned files. I have a lot of js libraries that don't change very often. Then I have a set of in-house libraries that change somewhat frequently, and another set of application-specific files that changes constantly. I'm wondering if it's worth the effort to combine javascript into three sep...

how to read rss by self ,not use the rss reader ,

I am using Google AJAX Feed to handle the RSS, then I store the data in my database. but I encountered a problem : how to read all data which updated since last time I read it (and I will lose some items), thanks ...

Allowing http iframe to call javascript on https parent frame

I have an https page (https://example.com/main.php) that has an iframe with a non-https source (http://example.com/inner.php). Both files are on the same server - just one is accessed with https and the other is not. I need the non-https page to be able to execute javascript on the https main.php page using code such as parent.myfunction...

Attempting to synchronize AJAX requests

I have been working on a new feature for a facebook game I have written. The game allows a player to travel between cities in Europe and deliver goods for profit. This feature that I'm adding adds pathfinding AI to the game: it allows a player to select a city to travel to, then the game automatically moves the player's train along track...

Internet explorer Object doesn't support this property or method.

I've got this code throwing an error from an iframe: function parentIframeResize() { var height = getParam('height'); // This works as our parent's parent is on our domain.. parent.parent.resizeIframe(height); } Not concerned about the error at all. The problem is it stop...

How to implement play or pause a flash?

I used a webkit to show a flash , but now I want to add a play button and control the flash , How to do ? thank you very much! ...

FB JS SDK: init not working?

i have copied this code from the FB.init documentation: <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script> ... <!-- facebook JS SDK init --> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { ...

When do I need to escape metacharectars? (jQuery Selectors)

According to the jQuery docs, I need to escape metacharacters that occur in my selector strings, when they occur as a literal. However, I couldn't find very many specific examples of when and when not to escape selectors. So when and when don't I need to escape metacharacters, when they are to be interpreted as a literal, in: Attribute ...

qTip Tooltip Issue

I am trying to use tabs on my page and each tab is loaded through the .load() javascript function. When I click on the first tab, I have the qTip tooltip provide a tooltip over each cell in a column of the table that is created. The tooltip works perfectly here. When I click on the second tab, the same thing happens to the table that is ...

variable scope and closure inside a module pattern javascript instance

I'm writing a jQuery plugin, and I'm writing it in a non-jquery-community-standard way, mainly to maintain portability and extendability. I'm having some trouble accessing variables that were declared in the function when accessing from the prototype. Perhaps I have this model very wrong but I hope someone can point out the correct...

What is causing the error "Uncaught TypeError: number is not a function"

I have an onchange event that updates a form, and in the updating process it calls a function to calculate shipping. I'm not sure why, but I'm getting the following error when I try to call the function: Uncaught TypeError: number is not a function The function, shipping, looks like this: function shipping( weight ) { var flat ...

What Tools Does Google Use to Manage Their JavaScript?

I was reading this article and came across this: Gmail engineer Adam de Boor surprised the audience by noting that the company's Gmail service was written entirely in JavaScript, and that all of its code, around 443,000 lines worth, was written by hand. Assuming he wasn't talking about GWT, that's a ton of JavaScript code. It made ...

Sometimes object.setAttribute(attrib,value) isn't equivalent to object.attrib=value in javascript?

It appears that sometimes object.setAttribute(attrib,value) isn't equivalent to object.attrib=value in javascript? I've got the following code, which works fine: var lastMonthBn = document.createElement('input'); lastMonthBn.value='<'; // This works fine lastMonthBn.type='button'; // This works fine But the following code doesn't...

jQuery update element using .each()

HTML code: div id="updatePanel">​ jQuery code: var data=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] $.each(data, function(index, value) { setTimeout(function(){ $('#updatePanel').text(index); }, 5000 ); }); I want the updatePanel div content to be updated every 5 seconds. It should be 1 then wait 5 seconds, display 2, wait for...