javascript

Detecting users out of browser view

Hi everyone I am working on an Ajax web chat and this application is updated using timed out Ajax requests every few seconds. Using timed Ajax requests means that the web server has to deal with a very heavy load and i would like to reduce the number of requests as much as possible. Since the timeout is triggered in the browser i would...

Checkbox and input field value

I have a check box which will change the value of a textfield to 1 when checked and change it back to zero when unchecked, how can I do this? I want it in javascript. ...

How to change the target of any local link when clicked, using javascript / jquery?

I need to change the href of any local link when it is clicked on. I've worked out how to select the correct links and create the new url, but not sure how to change the location. I need to be certain that any other click events have also run, so I can't just change the location immediately. var my_host = 'example.com'; $(document).clic...

How to localize javascript files in wicket

Hallo, a Wicket i18n question: I have a javaScript file, that holds strings I want to localize. Ideally I want to localize the whole file. Something like my.js my_de.js my_fr.js ... where wicket automatically chooses the right js file, as it does with property files. Any one knows how to do that? ...

What are the differences between JSON and JavaScript object?

I am new to JSON and JavaScript object. -Can anyone please explain the differences between JSON and JavaScript object? -What are their uses? -Is one better than the other? or it depends on the situation? -When to use which one, in what situation? -Why JSON was created in the first place? What was the main purpose? -Can someone give exa...

jquery selector needed to select all certain children of parent

Hi, I have a page with some tables on it. In each table the first row is normal but the rest of the rows have a class of hidden so that they are not displayed on load. In one of the cells on the first row of the table there is a link to click to view more details (fade in the hidden rows of that table). I'm struggling to get this to work...

optimize search through large js string array?

if I have a large javascript string array that has over 10,000 elements, how do I quickly search through it? Right now I have a javascript string array that stores the description of a job, and I"m allowing the user to dynamic filter the returned list as they type into an input box. So say I have an string array like so: var descArr = ...

text based countdown on canvas.

Hi, I would like to run a text countdown on canvas but last I checked there was no way to write text to a canvas. I would like to know if anyone else has come-across an implementation where I could do a numerical countdown from 60 to 0 on the canvas. ...

GWT adding Event Handler overrides the native one ?

Hi, lets say i have the following html element on my host page: <input type="text" onfocus="this.value = ''" id="textField"/> In gwt i wrap this into an TextBox Widget like this: final TextBox myTextBox = TextBox.wrap(DOM.getElementById("textField")); If i now want to add a focus handler what will happen? myTextBox.addFocusHandle...

Problem in Javascript colors and canvas.

I have used this code to exactly try to have the RGB code of color: var huePixel = HueCanvas.css('background-color').match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);//["rgb(0, 70, 255", "0", "70", "255"] var svPixel = SVCanvas.get(0).getContext("2d").getImageData(satPos,valPos,1,1).data; //opacity*original + (1-opacity)*background = resulting...

ExtJS Grid PagingToolbar refresh on store remove

I've setup a ExtJS Grid, while using the PagingToolbar (with PagingMemoryProxy on an ArrayStore). I have removed items from the store of the grid, but the PagingToolbar will not show that the items have been removed. Any suggestions on how to do this? ...

How can I dynamically set the image size ratio depending on the returned image in raphael?

How can I dynamically set the image size ratio depending on the returned image in raphael? Here is some code to give you an idea: var viewer = Raphael(0,0,scrWidth, scrHeight); viewer.image(dynamicUrl, 140, 140,300, scaledHeight); Thank you ...

PHP: on select change, post form to self

Hi folks, It's basically what the title says.. I have a form with a select control that I want to force the form to post back to self on change. $bmsclientlist = $clientobj->getBMSClientList(); echo '<form name="changebmsid" method="post" action="' . $_SERVER['PHP_SELF'] . '"><select name="bmsid">'; foreach($bmsclientlist as $bmscli...

JavaScript Confirm boxes with custom buttons

can i write custom confirm box in javascript.Instead of 'OK' and 'CANCEL' buttons i want to show 'SAVE' and 'DELETE' buttons. ...

using php to check is a javascript file has been loaded?

Can I use a script to check if a JS file is loaded? I have a function, which places a form on a page with javascript controls. I don't know where the user will use this form, and it might be loaded several times into a page. It strikes me as the best way to handle things if the form itself loads the script, so it doesn't load if not n...

javascript create and append element function not work

Hi, this is my javascript function : function createLink (){ var link = document.createElement("a"); link.href = "#"; var linkText = document.createTextNode("This is dynamic link"); link.appendChild(linkText); document.body.appendChild(link); } window.onload = createLink; but i am not get any result from this. any...

how to remove row in table using ajax?

i fetch the result from database on click event of combo box now i am try to remove or delete value from database and also remove from table row.problem is, when i click on href the value is deleted from database and display fetched result no showing.pls guide ...

Remove jquery datepicker from a html control

I have a datepicker on a textbox txtDate. I need to remove the datepicker, if a particular checkbox chkBox is checked. And to reapply the datepicker if the checkbox is not checked. I tried making the textbox readonly, but datepicker is still working. How to do this. EDIT: On the same checkbox event, I also want to make a select (drop...

What does tstbklt() from the Tumblr bookmarklet javascript do ?

javascript: var d = document, w = window, e = w.getSelection, k = d.getSelection, x = d.selection, s = (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)), f = 'http://www.tumblr.com/share', l = d.location, e = encodeURIComponent, p = '?v=3&u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s), u ...

cross-browser async uploader?

Anyone looked into this recently? 12 months ago i was using Uploadify 6 months ago i switched to Plupload which was the best i could find, what are people's thoughts, is Plupload still the best uploader for multibrowser async image uploads? I'm about to start a new site... ...