javascript

window.focus() not working in Google Chrome

Hey folks, Just wondering if Google Chrome is going to support window.focus() at some point. When I mean support, I mean have it work. The call to it doesn't fail, it just doesn't do anything. All other major browsers do not have this problem: FireFox, IE6-IE8 and Safari. I have a client-side class for managing browser windows. When I ...

JavaScript: Taking the highest 2 numerical values out of a series of 4 possible values

I'm trying to take the highest two values out of 4 possible variables and add them together, while ignoring the lesser two values. My values will be anywhere between 1 and 5. So, for example, if I have the variables: Trait 1 = 3 Trait 2 = 3 Trait 3 = 2 Trait 4 = 1 The script should pick up the 3 and the 3, but not the 2 and the 1. If...

How to define percentage canvas increase in photoshop javascript

I'm a javascript novice, I have this bit of code in a jsx script that I would like to resize the canvas +20 percent on both horizontal and vertical sides. resizeCanvas = docRef.resizeCanvas(curWidth + 20, curHeight + 20, AnchorPosition.MIDDLECENTER); 20 refers to whatever unit the ruler is set to. (inches, pixels, centimeters, etc). ...

Javascript callback function does not work in IE8!

I have a callback function in my open social application which fetches remote date. This works perfect on Chrome and Mozilla browsers but not in IE8. Following is the example for the same, help will be appreciated: This function: gadgets.io.makeRequest(url, response, params) makes the callback call and following function process the re...

implementing SRX Segmentation Rules in JavaScript

Hello , I want to implement the SRX Segmentation Rules using javascript to extract sentences from text. In order to do this correctly I will have to follow the SRX rules. eg. http://www.lisa.org/fileadmin/standards/srx20.html#refTR29 now there are two types of regular expressions if found sentence should break like ". " if found se...

Need help in downloading file with header() function

Hi. I'm trying to explain as best as I can, sorry for my English. I have a list of links, each linked to a php file with an id by parameters (ex. download.php?id=1 or ?id=2 and so on). This file create a new instance of a class witch return the correct header of the files so it displays the save dialog box of the browser. Now I need to ...

How to call c# server side method through javascript

Hi, I need to call a c# server method through the javascript. I have a gridview in which i have a column with dropdown list. When i change the dropdown's value i need to call a server side method through javascript and change the value of another text box in the gridview. I am able to do this on the selected index change. but i am slig...

How to display an activity loader automatically with all ajax requests?

I am working on Ruby on Rails application, with Prototype. I want to display a loading div automatically with every ajax request and hide it on completion, without writing code for every ajax request in my application. Is there anyway to do this. <div id="loader">Loading...</div> ...

PHP/Javascript limiting amount of checkboxes

Hi everyone Im trying to limit the amount of checkboxes that can be checked, in this case only 3 can be checked. When using plain HTML this works fine. The code can be seen below. HTML example <td ><input type=checkbox name=ckb value=2 onclick='chkcontrol()';></td><td>Perl</td> Javascript Function <script type="text/javascript"> ...

Toggle Image Overlays in Google Maps API v3

Hey guys. I've been building a small library for myself for a job I have at the moment building a map for a university. I've gotten pretty well everything I need in some basic form, but one thing has simply not been working, and is simply not giving me results. The university itself is sort of in a partnership with the neighboring c...

Detect which image with imagemap was clicked

When you have multiple images that share the same imagemap, is there any way to detect which image was clicked on when a user clicks on the image? I have created a little javascript app, where buildings (simple images) are placed on a map and can be dragged around. When a user clicks on a building, the building can be easily retrieved ...

Javascript checkbox state change

Hi all This is going to be straight forward for anyone who understands this language. I have a set of checkboxes, which I am successfully detecting via Javascript on window load. I now need to detect any change in these checkboxes (ie checked/unchecked) and call in a function to do something else. However using this snippet causes the...

Wrap CKEditor WYSYWG content with additional (non editable) HTML to apply element specific formatting

I am attempting to have the WYSYWG view within CKEDITOR display with the same formatting as it will within the final rendered HTML. I am currently applying the correct CSS through specifying the contentsCss property when loading CKEditor. This works fine for some of the formatting, however a lot of the css formatting is applied to elem...

Unescaped '^' with jslint

This is my code: /********************************************************** * remove non-standard characters to give a valid html id * **********************************************************/ function htmlid(s) { return s.gsub(/[^A-Z^a-z^0-9^\-^_^:^\.]/, "."); } Why does jslint throw this error? Lint at line 5 character 25:...

get the value of 3 hidden fields in a html tablerow where the checkbox has been checked

Hello all, i need to get the value of 3 hidden fields in a gridviewrow where the checkbox has been checked & build a querystring with them. I can only use Javascript, it's not possible to use postback in our framework :s Any ideas? thanks ...

Where is the error in this code.

Hello, Here is my code snippt. But the code is breaking after inner for loop. But getting no error message. Any idea? Thanks. var lastnames = document.getElementsByClassName('box_nachname'); var firstnames = document.getElementsByClassName('box_vorname'); var teilnehmer = document.getElementsByClassName('select'); ...

JavaScript on Android randomly stops working

Hi! I have an application that uses a WebView and a html-page with javascript functions. Randomly the JavaScript functions doesn't seem to be called. It works up to a random point (I have looked at this bug all day) can only be produced on hardware (HTC Legend) not on emulator. Basicly I'm using callback to javaScript whenever the user...

Properties of JavaScript objects

In my JavaScript, I'm using an object as an associative array. It always has the property "main", and may have others. So, when I create it I might do this: var myobject = new Object (); myobject["main"] = somevalue; Other properties may be added later. Now, at some moment I need to know whether myobject has just the one propert...

Alfresco: Find associated working copy of a node

Hello, Is there a way to retrieve the Working Copy Node of a given locked node? I am building a webscript using javascript for Alfresco. Thank you. ...

Preview Site as Thumbnail

Hello all, I am trying to figure out how services like snap shot are so fast in showing a preview of a site as a small thumbnail when you hover over a link? I mean I can generate a thumbnail of a site and show it but it will take me 10 seconds or more but for services I have seen that provide this, its almost a second or two. How are t...