javascript

On artimap.com you can search by double-clicking a word. On some ie8 it display: accelerator... Is it possible to eliminate that crappy ie8 behavior ?

var getSelectedText=function(){ var x; if(window.getSelection){x=window.getSelection();} else if(document.selection){x=document.selection.createRange();} if(x.text){x=x.text;} return x+''; // just to be sure it always return a string }; var phrase=function(s){ return s.match(/[^ \’\‘\"\'\.,;:\#\-]+/g); }; va...

remove line breaks and white spaces

hi I have an textarea which anyone can enter text, where they can put line breaks inside the text area. How can I remove the line breaks created by pressing the enter key? can either be in c# or javascript. ...

Why does dynamically populating a select drop down list element using javascript not work in IE?

I have a <select> element that I dynamically populate with different values at runtime. I use the code below to clear the <option> elements and then reload it with new ones. It works in Firefox 3.6.6 and Chrome 5.0. function loadPickerFromObject(pickerControl, values) { pickerControl.empty(); for (var nameProperty in values) { ...

How do I store this JSON object as a cookie and than read it in vanilla javascript?

I can actually seem to write it fine as a cookie like this: ["4c3dd477c441e17957000002","4c2ac3cc68fe54616e00002e","4c3dd477c441e17957000003","4c3dd477c441e17957000004"] But how do I read the cookie? I'm using node.js/express.js (and coffee script), and when I read it the cookie key the value I get is just the first value of the abo...

Given an arbitrary javascript object, how can i find its methods?

I know this is possible in python, but can i get a list of methods for a javascript object? ...

passing from one lightbox to another ?

Hi, Currently I am working on lightbox in which i want to transfer the list present from one lightbox to another. When i clicked on any one element of that list it must go to other lightbox having same url and id parameter as in 1st lightbox list element. Please help Thanks ...

jQuery UI: Can an object be selectable and draggable simultaneously?

I have objects that I want to be both draggable and selectable. Is this possible? var course_li = $(sprintf('<li class="course%s">%s</li>', already_scheduled_class, course["fields"]["name"])); // ... course_li.draggable(DRAGGABLE_COURSE_SETTINGS); // ... if (in_course) { course_li.draggable('disable'); } // ... $(".course...

Launching a legitimate pop-up window on user click

Hi, I know there are many threads about how to defeat pop-up blockers. In this case, I'm not really trying to do that. By default, browsers do not block -all- pop-ups. Legitimate ones such as when users click on it, are allowed. This is a good test: http://www.popuptest.com/goodpopups.html (works in IE, Firefox, Chrome, Opera) How the ...

How can I restrict the text entered into an input text element using jQuery?

I have an input text element being used as a jQuery UI datepicker with a custom date format. The date format allows months to be entered in as JAN, FEB, etc and so the constrained input allows all characters to go through. See this question. How can I restrict the text entered to match my date format "dd-M-yy"? Is there a way to use jQ...

greasemonkey: stop embedded JS from running

A page has the following in the html: <script type="text/javascript"> // some code </script> My greasemonkey script needs to prevent that script from running. How can I do this? Update: I understand that in the general case this is impossible. However, in my specific case, I may have a loophole? <script type="text/javascript"> ...

jQuery UI: Make only one item across many selectables be selectable at a time?

I'm trying to use the jQuery UI framework with selectables. First off, is it possible to disable allow selection with mouse drag/lasso? Secondly, I have several selectable elements, and I want only one of their children to be selected at a time: <ul class="ui-selectable"> <li>foo</li> <li>bar</li> </ul> <ul class="ui-selectabl...

Altering 6 images then preloading but the images are being pre loaded before they are altered.

I have 3 images of a horse/knight running. I am alternating them to make it look like its running. I am using GD to alter the colors of the knight/horse for the specific users chacter. I alter the images color then preload the 3 images. but by the time my program has altered the images they have already been preloaded. so i have to load ...

Using Javascript to override or disable meta refresh tag

I have a website, where I am trying to use Ajax to update some stuff on the page without reloading it. However, there is a good chance that many of my users will be using mobile browsers that don't support Javascript so I am trying to design the page with meta refresh tags, that somehow work only for users without Javascript. Is there an...

Is there any way to resize the images based on screen resolution with out using javascript?

I am planning to use a big banner image in my website(976X450).Now in higher resolution monitors the image should stretch to occupy the space. Is there any way to do this with out using different images for different resolution? ...

Is there a way to find all elements matching a certain style using the DOM?

I want an array of all elements that have fixed position. This is what I've got so far (mootools code) $$('*').filter(function(aEl){ return aEl.getStyle('position')=='fixed' }); Is there a more direct way to do this? ...

Getting all values (selected and not selected )from html multilist

Hi, I have two html multi lists List1 and List2. List1 contains all the attributes of a table from DB. Now I have buttons Add, AddAll which will take data from list1 to list2. Now I wants to pass the attributes which are added in list2 to another .jsp page on submit. How can i do this? Thanks in advance. ...

Impossible site for HtmlUnit?

I cannot, for the life of me, rig HtmlUnit up to grab this site: http://www.bing.com/travel/flight/flightSearch?form=FORMTRVLGENERIC&amp;q=flights+from+SLC+to+BKK+leave+07%2F30%2F2010+return+08%2F11%2F2010+adults%3A1+class%3ACOACH&amp;stoc=0&amp;vo1=Salt+Lake+City%2C+UT+%28SLC%29+-+Salt+Lake+City+International+Airport&amp;o=SLC&amp;ve1=...

access javascript global variable from codebehind in asp.net

get the value of Global variable in javascript example var a="priti" so want to access "a" in code behind as it's global varible ...

how to call javascript when load jsp page ?

I have a button which should be disabled when the JSP page loads. How do I achieve this? ...

Making Jquery.ScrollTo work based on speed instead of duration

I'm creating a horizontal site (it could also be any other auto-scrolling site, like diagonal) which uses the $.Localscroll child from the Jquery.ScrollTo plugin. There's one big problem with this plugin; it calculates movement based on a duration. This means the transition from page 1 to 2 takes up 2 seconds, but a transition from pag...