javascript

javascript setTimeOut - not running on nested setTimeout

Okay, I seem to be having a problem. I'm trying to create a twicker to display rows of data. I'm using jquery/javascript to hide and show rows after a certain time. Here's the code: <html> <head> <script type="text/javascript" src="jquery-1.3.2.js"></script> </head> <body> <script> var timer_is_on=0; function doTimer() { if (!tim...

Javascript: Behavior of {}

I didn't have a understanding on difference between intializing a variable with {} and a named-function with new keyword. I mean which practice should I use to give a definition of an object. Which is more appropiate and for which case? Then I made a little example to test both practices. And I found a very simpl...

Display popup without security warning

Hi, I use Silverlight and I'm trying to get some data to the user side. I can easily display PDF file with an <embed> tag in the browser. However, I also have to be able to save files form the server. I tried the SaveFileDialog from Silvelright but it doesn't allow setting the file name (which is an issue). I tried setting a hidden <if...

How to display "username" and "password" as default in text boxes in javascript?

I want two text boxes with default text in both i.e "username" and "password". When we click inside the text box the text should disappear so the user can type their own username and password. However, the password field is not readable by default. How is it possible, kindly help me??? Thanks in advance. ...

IE7 issue - cannot download streamed file when Automatic prompting for file downloads is disabled

Hi, My application is J2EE (JSP/Servlet) based. I encounter an issue when i try to open a new window (pop-up) from JSP and call a Servlet action (e.g. Streamer.do) which streams a PDF file inside that pop-up. Problem: While IE 7 -> Tools -> Internet Options -> Security -> Custom Level -> Downloads -> Automatic prompting for file downl...

Make a call to javascript function from actionscript

Hi All, I am trying to make a call to javascript function from actionscript. As of now, I am using 'ExternalInterface' and could achieve partial success. I could make a call to function(without any scope resolution) like "scanDNA()", which is visible to all. But am not able to make a call to function(scope specified) like "Eukarya.An...

AJAX loader GIF while asynchronous POST request doesn't work in IE.

Hi folks! I'm trying to show an AJAX loader gif while an asynchronous POST request is performed. Unfortunatelly this works not in Interet Explorer! The Gif is shown, but the request process seems to stop respectivly the changed webcontent will not be shown. On FF, Opera, Safari everything is fine! Any ideas? http_request.onreadystatech...

Preventing Dojo data.store race condition.

I'm using dojo.data.ItemFileReadStore to get data from a json source into a dojox.grid.DataGrid. I replace the datastore with DataGrid.setStore(), which works fine, except when I try dto do it before the old datastore has finished loading, which instead causes the DataGrid to crash and being unable to recover. How can I prevent this race...

JSON Delete Table Row

I'm trying to delete a row of data using JSON, however when I prompt a confirm dialog my javascript function doesn't work as follows: <script type="text/javascript"> $().ready(function() { $("a.delete").click(function() { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: this.href, d...

Collection item knows about collection it is contained - does this smell?

Allright, this might be a strange question and maybe I am heading the wrong direction, but here is my problem: I have a SearchForm object which holds a collection of Tag objects. When a Tag object is clicked by the user, it highlights itself and triggers an event. The SearchForm class listens to this event and submits itself. The Tag o...

javascript: what is the "default" method?

I was browsing through the NPAPI documentation and I stumble on InvokeDefault method. Of course I googled a bit but without turning related results. So the questions are to the Javascript experts: 1) What is a "default" method on a JS object? 2) How can one declare & define such method? ...

Losing line-feeds/carriage-returns on post.

Any help on how I would keep carriage-returns in the text that I am posting? function checkPlayState(checkStatus) { var Player = document.getElementById("NSPlay"); if (Player.playState == 0 || Player.playState == 1) { // 0 vs 8 if (checkStatus == true) { var tex_t = document.getElementById("ctl00_Content...

How to save the state of a dojo grid

I want the user to be able to save the state of their grid, so that their sort options, column widths (and order) are preserved for the duration of their visit. Does anyone know of a way of doing this? I have noticed that the dhtmlXGrid provides a cookie interface for doing this: http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid%3Acoo...

Which of these setTimeout format is better?

Which of these constructs is better and why setTimeout(function() { $('#secret').hide(); }, 5000); setTimeout( "$('#secret').hide();", 5000); $('#secret').show(5000, function(){ this.hide(xxx)} ); ...

javascript "in" strange or normal behaviour?

I have a multiple select and I made a function to check several parameters, each prints a different value in another form: if ( (tot_v >= 10) || (perc_a < 100) ) { $("#DA_IDO").val('1'); } if ( (tot_v > 3) && (tot_v < 10) && (perc_a == 100) ) { $("#DA_IDO").val('2'); } if ( (tot_v <= 3) && (perc_a == 100) ) { $("#DA_IDO").val('3')...

What is the best HTML/JavaScript Framework for a Flex Application?

We're currently building a Flex application using the PureMVC framework with a shell.swf which loads/unloads modules dynamically. We're experiencing issues with memory and we're looking to replace the shell.swf with a JavaScript-based loader. Two questions: What would be a good framework to dynamically load the Flex components and all...

Method is not a function

I've tried code from here http://www.webreference.com/programming/javascript/gr/column3/ but firebug says - "this.preload is not a function". Why? I thought that Function is some sort of Object. ...

"Diagnostics Results" is an invalid value for the window title in window.open function

Did you know? "Diagnostics Results" is an invalid value for the window title in window.open function wtf? ...

Multidimensional array serialization

function source_of (array, up_to_dimension) { // Your implementation } source_of([1, [2, [3]]], 0) == '[1, ?]' source_of([1, [2, [3]]], 1) == '[1, [2, ?]]' source_of([1, [2, [3]]], 2) == '[1, [2, [3]]]' source_of([532, 94, [13, [41, 0]], [], 49], 0) == '[532, 94, ?, ?, 49]' I have very huge multidimensional array and I want to ser...

javascript browser-like GET request

I need to request web page client-side and than pass it to server as a string. I tried jQuery: $.get( "http://example.ru/", {name:"Joe", age:"42"}, function(data){ $.get( "script.php", {data:data, query:query}, ) }); }); but did not succeed. I suspect it failed because of custom ...