javascript

How to programmatically generate a window.event using Javascript?

Hi all: I am currently unit testing some javascript, where it handles an event raised by clicking on a certain item in the window. Below is a snipet of the code: function someFunction() { var evt = window.event ? window.event : event; if (evt == null) { return; } var nodeElement = evt.srcElement; if (nodeElement =...

anyone know how twiddla accomplished its browsing abilities?

Hi all, I realized that you cannot just insert <iframe src=remote-page-here></iframe> and expect it to work, and twiddla is not using any flash, so I'm curious as to how they accomplish the in place browser thing. If anyone can enlighten me on that it would be great! Jason ...

Dynmically placing the input types inside(table) a <td> tag - innerHTML tag is not working in internet-explorer .

Hi all , I need to dynamically place input types inside a <td> tag - innerHTML() method is not working in Internet Explorer. It works fine in Mozilla. This is the way I'm placing the input types in the JavaScript, where ValueCol is the <td> id, On some action I have to change the control to text box. document.getElementById("Value...

eval json out of memory error

Hi, I'm using JSON.parse function to load info about a cellset. I'm testing how much data is possible to fetch in one call. The eval function starts throwing "out of memory" between 1.3-1.4 million characters (65,000-70,000 cells) in the JSON string. Does anybody know of a workaround for this - perhaps a pure JSON parser, rather than e...

Change base href using javascript

Can I change the href by javascript? I use the following code in but it doesn't work: <base href="/" /> <script type="text/javascript"> function setbasehref(basehref) { var thebase = document.getElementsByTagName("base"); thebase[0].href = basehref; } //setbasehref("/"); setbasehref("http://newurl.com"); </script> ...

What is strophe and how to use it with JQuery?

Can somebody explain what strophe is? I believe it has something to do with XMPP? How can I incorporate it into a site using Jquery? ...

Is it possible to populate a SELECT dropdown when clicking on it?

I'd like to have a bunch of SELECT dropdown lists on my page which can be empty initially. When the user clicks on one of them, I want an AJAX call to be made to the server to get the desired list for the chosen dropdown. The results of this AJAX call are then put inside the dropdown and the dropdown then works as normal. Is this possib...

Center a xul dialog to screen

In a dialog, I resize some images and then force the window to sizeToContent. Then, I want the dialog to center itself to the screen. How can I do this? ...

accessing javascript from inside java

Hello all. I know that there are lots of examples out there on this, but they all feel a little dated (even the sun docs) so I'm asking here to make sure what I'm doing is up to date. How would I go about talking to javascript from inside a java applet? Something simple like how to call alert() is all I'm looking for. Bonus points for a ...

HTML5 Local Storage of audio element source - is it possible?

Hi stackoverflow experts I've been experimenting with the audio and local storage features of html5 of late and have run into something that has me stumped. I'd like to be able to cache or store the source of the audio element locally to enable speedier and offline playback. The problem is I can't see how this is possible with the cur...

Creating SVG graphics using a server side script (PHP)

Hi Guys, Is there a way to generate an HTML file using a PHP script which has an SVG embedded where the SVG itself is dynamically generated by the PHP script? Basically, I want to display a dynamically generated SVG image to a client but <embed>, <object> as well as <iframe> only refer to external sources while PHP generates the curren...

GMT vs UTC dates

Hi, I have a calendar build in JS that compares dates with PHP. The JS date object is set using PHP but when I compare future dates they appear to be out of sync. PHP is set to GMT and JS is set to UTC, how do these standards differ and could this be causing the problem? Thanks ...

[PHP / AJAX]: Change color of the message according to the entered text.

In my website home page, I have a new user registration Form. It contains a field "User Name". When the user enters the user name and the focus is pointed to another field, an AJAX code is executed that checks whether any user with the entered username already exists or not. The AJAX code that I am using is this: function toggle_userna...

Javascript jquery to contact an API

I'm trying to connect to a webapi at a location that looks like this from inside my js jquery file. example.com/?var=input Is there a simpler way to do it than an ajax call? ...

What's wrong with this code?

For some reason, every piece of code that's below this snippet won't run... I don't see anything wrong with it ... window.navigationDropdownTimeout = 0; $(".navigation li.expanded > a").hover(function(){ clearTimeout(window.navigationDropdownTimeout); $(".navigation ul ul.menu").hide(); currentSubnav = $(this).next(); currentS...

How to get the size of a dynamically loaded swf with javascript?

Hi, I want to get the dimensions of a dynamically loaded flash object and resize a DIV accordingly to it. I can't use a server side language to do it. I've tried searching about loading and reading the header portion of a SWF file to get it's dimensions with javascript but came up empty. Is this remotely possible/feasible? Thanks in ...

Flash as a socket gateway for javascript

hi everyone, i just completed a web based chat application based on ajax/php. But the problem with this app is that it has to continuously poll server to check for new messages, which in turn overloads the server if many people are using this app simultaneously. now i want to implement a socket based chat app in JavaScript. I know ...

I am looking for menu on JQuery

May be some body already used some open source component, writing on jquery. And I want to place this menu on right panel of my site. Thanks to advance ...

Replacing whole HTML content kills HEAD and BODY tags after HTTP Request!

After pressing a button, I'm sending the whole HTML content from a webpage (the part within the <html> tags) to a CGI script which manipulates the content and sends it back. Now I'm trying to replace the existing content with the new one. Unfortunately after assignment, every single <head> or <body> tag (as well as the closing ones) wi...

Singleton Pattern with {}?

I apologize to move it from here as there was some confusion and thanks to Grey for answer this to realized the mistake. The topic has been moved to http://stackoverflow.com/questions/1612703/how-to-design-an-object-on-singleton-pattern-in-javascript to discuss further. Singleton Pattern with '{}'. Here how it is: var A =...