javascript

Google Maps fitBounds is not working properly.

I have a problem with googlemaps fitBounds functions. for (var i = 0; i < countries.length; i++) { var country = countries[i]; var latlng = new google.maps.LatLng(parseFloat(country.lat), parseFloat(country.lng)); mapBounds.extend(latlng); } map.fitBounds(mapBounds); Some icons will be displayed outside the viewport / Visible are...

Make jQuery Captify show images captions permanently

Is there a way to show captions for images permanently on page load, not only when I move mouse cursor over the image? ...

How to change the selected item in a Firefox Extension's Menulist?

I'm writing a firefox extension and I have a menulist of links that should be automatically (upon load) set to the last link it was set before I closed it. It just keep being set to the first menu item. I've tried using setAttribute('selectedIndex', 1), but that doesn't work. What am I doing wrong? Some sample code: <menulist> <menu...

jquery temporary unbinding events

Hello, maybe I'm totally missing something about even handling in jQuery, but here's my problem. Let's assume there are some event binding, like $(element).bind("mousemove", somefunc); Now, I'd like to introduce a new mousemove binding that doesn't override the previous one, but temporarily exclude (unbind) it. In other words, when I...

Javscript/jQuery Click Element within Element

Hello, This is probably something quite easy to resolve, but for some reason, I can't figure it out. I have the following HTML: <li onclick="function_1();"> <input type="checkbox" onclick="function_2();"> <div onclick="function_3();"> </li> My issue is: Whenever I click one of the child elements (either the checkbox or div), it ...

Add attribute 'checked' on click jquery

Hi there, I've been trying to figure out how to add the attribute "checked" to a checkbox on click. The reason I want to do this is so if I check off a checkbox; I can have my local storage save that as the html so when the page refreshes it notices the checkbox is checked. As of right now if I check it off, it fades the parent, but if I...

Windows media player control embedded into HTML - change of control's size after starting playback

I use the following html to show media player on the web-page rendered in IE 8: <OBJECT type="application/x-ms-wmp" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" width="200" height="200"> After starting playback the size of the control stays the same. However, when I create the control dynamically in JavaScript, after starting...

Custom icon in TabPanel fails

Hi all, I'm trying to add a custom icon to a TabPanel but when I do that it just shows a dark box with rounded corners. My css looks like this: http://pastebin.org/447682 The code in the url is base64 for some random rss icon I found on the web. I also tried to add a relative url to an image but without any success. If I change my co...

Merging two strings of key=value pairs in JavaScript

I'm trying to come up with an efficient way to overwrite 2 strings that look like this: str1 = "width=800,height=600,resizable=no,titlebar=no"; str2 = "width=100,height=100"; In the above example, str2 should overwrite str1 to produce str3: str3 = "width=100,height=100,resizable=no,titlebar=no"; In my tests, I turned str2 into an a...

How to do multi-line Title in div tag?

I'd like to have the following div tag display a tool-tip on mouse hover. But, it displays it as a single line. How can I get it to display several lines? <div title="Have a nice<br />day">blah</div> ...

Fetching xml with GM_xmlhttpRequest

I'm trying to retrieve a page with greasemonkey and then extract a link from it, inserting the link into the current page. I'm having some trouble with: GM_xmlhttpRequest({ method: "GET", url: "http://www.test.net/search.php?file=test", onload: function(data) { if (!data.responseXML) { data.responseXML = new DOMParser...

How to create XPCNativeWrapper for HTMLDocument

Hi, I am having troubles with making my Firefox extension use xPath on a page loaded via AJAX inside my extension window. Here https://developer.mozilla.org/en/DOM/document.evaluate it says that evaluate can be used with HTML or XML documents to evaluate xPath expression. So, i created a HTMLDocument object, assigned the AJAX response ...

Javascript reload page in a closure/anon function?

I am using jQuery to animate some DOM elements, but I want the page to reload when the animations are complete, so I tried this: function childDisablePopup() { $("#popup2",window.parent.document).animate({ width: "0px", marginLeft: 0 }, "fast", function() { $("#popup2",window.parent.document).anim...

How to store an array in a javascript cookie?

Does anyone have a piece of javascript code that creates a cookie and stores an array in it? If you also have the code to read through through cookie and delete it, that would be great as well. Thanks! ...

Jquery Cycle Plugin set thumbnail location

First off, my question is really similar to a question posted here, with the difference being I am using wordpess and the nextgen gallery plugin to manage my images, which writes images thumbnail images as such: mygallery/image1.jpg mygallery/image2.jpg etc... and thumbnails like this: mygallery/thumbs/thumbs_image1.jpg mygallery/thu...

jquery select element

Hi, Facing some problems with jQuery selectors. My HTML is like: <form method="" action=""> <p id="question_1"> <h1 id="question">1. A Question</h1> <div id="choices"> <p id="option1"><input type="radio" id="option" name="q_1" value="1" />A</p> <p id="option2"><input type="radi...

Need a ROT47 JavaScript Implementation

I found the following code to decode a ROT13 string and put it into a webpage with JavaScript: <script type="text/javascript"> document.write("string".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);})); </script> I need a similar JavaScript code to decode ROT47. I found ...

Pushing messages to clients from a server-side application?

I have a javascript-based client that is currently polling a .NET web service for new content. While polling works...I'm not happy with this approach because I'm using system resources and creating overhead when there aren't any changes to receive. My question is how do I notify my client(s) that there is new content for it to displa...

Is the "async" attribute/property useful if a script is dynamically added to the DOM?

This question is sort of a tangent to Browser support for <script async=“true” />?. I've seen a few scripts lately that do something like this: var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'http://www.example.com/script.js'; document.getElementsByTagName('head')[0].appendChild(s); This...

media queries image file name change on screen size

I've been looking at using media queries on a site but bolt at the idea of downloading a huge file only for it take ages to download on a iphone over 3G. Is it possible using jquery to alter a filename (ie. add -iphone to background.jpg to make background-iphone.jpg) when the site is viewed on an iphone / netbook / ipad perhaps using me...