javascript

Delete duplicate entries from a select box

How would I, using jQuery, remove the dups <option value="English">English</option> <option value="English">English</option> <option value="English">English</option> <option value="Geology">Geology</option> <option value="Geology">Geology</option> <option value="Information Technology">Inf...

Does WordPress expose a base URL in its JavaScript by default?

Usually when building sites I add something like this var config = { basePath: '<?php echo BASE_PATH; ?>' } Simply so with my static JavaScript files I can do AJAX requests like var request = config.basePath + 'ajax/get-something'; Does WordPress have a similar variable available to its JavaScript files by default, assuming I a...

Jquery Draggable UI overrides normal browser behavior for HTML elements inside draggable-enabled div

I have a jquery ui draggable div, and the HTML contents do not behave normally because of the draggable. <div id="popup"> <!-- this popup is draggable --> This text is not selectable. When I try to select it, the popup div is dragged. <div style="overflow:auto; height:50px"> Lots of text here, vertical scrollbar appears...

UIWebViewNavigationTypeLinkClicked not works for "location.href" links

I have a UIWebView with a UINavigationBar, that shows a UIButton to turn back to the previous page. This code works well with link of type <a href>, but not with location.href. How can I do to make it works? - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)r navigationType:(UIWebViewNavigationType)navigat...

Writing PHP into Javascript or Javascript Into PHP

i have this code var myChart = new FusionCharts("../themes/clean/charts/hbullet.swf", "myChartId", "400", "75", "0", "0"); myChart.setDataXML("<chart lowerLimit='0' upperLimit='100' caption='Revenue' subcaption='US $ (1,000s)' numberPrefix='$' numberSuffix='K' showValue='1'><colorRange><color minValue='0' maxValue='50' color='A6A...

JS Unit Testing on NUnit/NAnt

Maybe you know the simplest way of unit testing javascript functions (not UI like Selenium or WatiN) which can be automated (I prefer using NUnit, eventually NAnt) ? I need to introduce an automated unit test for javascript functions on CruiseControl.NET (so with NUnit and NAnt) - but maybe there is other way ? Thanks, Dawid ...

Saving changes in SlickGrid

HI, I'm looking at SlickGrid and I can see example on how to edit the cell, however do I save these changes. I have yet to find an example that tells me how to do this. ...

AJAX loaded content to be crawable by google

Hey guys, Here is my case: I use some external source to load html data to my page, after that I put content of this html to div. So, as soon as page loaded and ajax call finished, I see the results. It works, Ok.. but now I came up, that this dynamically loaded content is not crawable by Google bot.. and this is something that I don't...

YUI skinning scrollbar used in container

How can I implement custom-looking scrollbars in YUI containers? ...

Add Mouse Wheel scrolling ability

Hello, I have this script which enable scrollbar within <div> I want to add functionality to scroll even using "Mouse Scroll-Wheel" Here is code : var TINY={}; function T$(id){return document.getElementById(id)} function T$$$(){return document.all?1:0} TINY.scroller=function(){ return{ init:function(a,c,b,s,d){ a=T$(a); a.c=c...

How to find out all installed fonts on user machine?

Is there any way to get the name of all installed fonts on user machine using HTML, javascript? One way is to use classid, but i would like to know any other way round to do this? ...

How do I add objects to the jquery result object?

I'm not sure if I'm doing something wrong here or not, but I need to base the status of several objects off of the status of another. So I'm basically iterating over the parents, then getting their children and iterating over them to get their children etc. However, I don't know how to add jquery objects on to a jquery result object. My...

stand-alone lazy loading images (no framework based)

I look after a site which by nature has to load quite a lot of images and content on the page. We have decreased the number of elements and graphical layout images as much as we can, so we are now looking at ways to increase the page load in the browser. Does anyone know any code for lazy loading images that doesn't require a framework ...

Pushing mouse click location to an array in Javascript

Hey guys, I'm trying to push the coordinates of a mouse click on a particular element to the end of an array. This is what I have: IN THE HEAD: var seatsArray = []; IN THE BODY: var coordinates = document.getElementById("image"); coordinates.onclick = function(event) { seatsArray.push(offsetX, offsetY); } document.write("Seats ar...

How to change cursor based on mouse position ?

I would like to change the cursor from default to pointer when the mouse enter the rectangle (50, 50, 100, 100) of the body element (the numbers are in pixels). I know that I could define a div, place it at this position, and set cursor: pointer; on it, but I'm looking for some way without defining a div. I would like to something like...

Histogram in flot - Javascript

Hi folks, I'm trying to create a histogram in flot, where the bars are organized by day. I cannot find a way to merge values into 1 bar per day. __ Any ideas? ...

How to highlight an input field with validation error with Trinidad (JSF)?

After failed client side validation of a form Trinidad shows error messages and highlights labels of failed inputs. I need to highlight the input fields themselves. Is it possible to do it somehow? The most desperate solution I can think of is attaching js event listener on DOMAttrModified event on labels, but it's really an awful hack. ...

String concatenation within a javascript object

I'm sure there is a simple answer to this but I couldn't find it. I know how to concatenate a normal string in JavaScript but how would I do it within an object? I require this as I'm reading through an XML file and creating the HTML for a list of links. Each time I go through the loop I want to create a new <li> containing the link. ...

Javascript proxy URL generated by .SVC file does not work under SSL.

I have an ASP.Net web site deployed in IIS 7.5 with a file Cart.svc (used for Javascript access from the browser). The javascript renders fine under non SSL but SSL causes it to halt. However, if you take the /js suffix off, it works, even under SSL. So it looks like there IS a process listening on SSL, it just does not like the /js suf...

problem dealing with request parameter using jsp within a javascript block

Hi all, I've a jsp page which saves a request parameter inside a javascript variable. Say a user visits the page through a wish list then the param fromWishList is set to 1, if the user visits this page from other source then there is no param called fromWishList. //following code is inside a jsp page <script type="text/javascript"> ...