javascript

stack a div under an absolutely positioned image that changes in scale

Hello, I used a jquery image scaling plugin for a large image on this page I am building: http://seans.ws/sandbox/test/thrive/ I am trying to put a navigation div below the image, but I cannot do so because the image is absolutely positioned, and the scale of the image changes, so I cannot just specify a padding-top value for the navig...

Control website via desktop application

Is it possible for a desktop application to communicate with a javascript API that will affect the user's browser? For example, I would like to call a JS API of a web service even if the browser is not in focus. The user can select various functions from within the desktop application and it will take effect in the browser. thanks ...

Javascript in IE8: how to sort array of objects by alphanumeric property

I've got an array of Javascript objects that I'd like to cross-compatibly sort by a property that is always a positive integer with an optional single letter at the end. I'm looking for a solution that works in at least Firefox 3 and Internet Explorer 8. The closest I've come to such a sort function is the following: var arrayOfObjec...

Can I detect cpu type and speed, and/or amount of ram a computer has from a web page (javascript hopefully)?

Can I detect cpu type and speed, and/or amount of ram a computer has from a web page (javascript hopefully)? ...

Google Maps v3 - can I ensure smooth panning every time?

My map has several hundred markers within a city. Usually no more than a 20 mile radius. I've read through the documentation and haven't found a way to set the init to automatically pan between every marker, no matter the distance. The default behavior is to pan if close, jump if far. I understand why they would do this since the map doe...

IE v. FF: Is table.tBodies[0] valid?

From what I gather, tBodies[0] seems to work in IE, but not FF. Is this an IE mistake? I've created a small file to demonstrate the incosistency, and I would like to know the best way to go about this. The HTML: <html> <body> <table id="dataGrid"> </table> <input type="button" onclick="insertRow();" value="New row"> </body> </html...

Resize image with jQuery

Hello, The scenario: I’m building a website, which will not Host the images in its own server. Instead it will reference images from other servers. Example: The website is hosted at www.mywebsite.com, and the html of the images will be something like <img src=”http://www.otherwebsite.com” />. The images from the other servers will be...

how to pass to fetch new records only with ajax/json

I have a DB containing small news and a web app displaying these. I would like to update my page every 60s with a jquery.ajax or jquery.getJSON request . My question is how should I pass the last id i received from the server to the next ajax request so that i got only newer news? Where do I store it (on the DOM, into a global var, or ...

Is there a way to pull valid script from html content and execute it using jQuery?

Say I have a something like this: <p id="script">$("p").css("color", "red");</p> Is there a way to select the script contained within the tag and execute it using jQuery? In this case, the script $("p").css("color", "red"); would be executed and then cause itself to be rendered with a red font color within the paragraph tag. I can...

Google Maps v3 - limit viewable area and zoom level

Hi, is it possible to limit Google map v3 to a certain area? I want to allow displaying only some area (e.g. a country) and disallow the user to slide elsewhere. Also I want to restrict the zoom level - e.g. only between levels 6 and 9. And I want to use all the base map types. Is there any way to achieve this? I had a partial success...

Don't load hidden images

I have a bunch of hidden images on my website. Their container DIVs have style="display: none". Depending on the user's actions, some images may be revealed via javascript. The problem is that all my images are loaded upon opening the page. I would like to put less strain on the server by only loading images that eventually become visibl...

How to add number of days to today's date?

I need to be able to add 1, 2 , 5 or 10 days to today's date using jQuery. I'm a novice and trying hard to learn. ...

JQuery UI - How do you do multiple toggles from a listBox?

I have a listbox in a form, and based on the answers within I want to open a different toggle, using JQuery UI's toggle effect: http://jqueryui.com/demos/toggle/. The code is visible under 'view source'. Part 1: the code in current form does not support multiple toggles on one page. How can I rewrite the javascript and id the divs diffe...

XMLHttpRequest read progressive data not working?

I'm having issues with XMLHttpRequest downloading progressive data. I get a state 2 and than state 3. After state 3 it never gets called again... What am I doing wrong? I read somewhere I need to flush the data but how do I do that? Here is my code: var xmlHttp = new XMLHttpRequest(); // try to connect to the server try...

Reset user geo location on page load. Delete & set a cookie.

I'm running a geo-location-javascript (http://code.google.com/p/geo-location-javascript/) to find and set the users latitude and longitude to a cookie. I'm running this to try and update the cookie on each page load. <script> function del_cookie(name) { document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01...

Use jquery to get an input's id and compare it against a static array of id's?

Hi, I am using jQuery to create a client-side validation function for a .NET form. Each form element has an id and several of the form elements are required fields. In my validation script, I thought of creating an array of the id's of the 'not required' elements, then on every 'blur' event checking whether or not the current element (...

How can I change link text color on OnClick if there is Window.Open

I have a link that has an OnClick event defined with Window.Open - I want to do one more thing on OnClick - change the color of the visited links on the page. But If I define this.style.color=blue on the OnClick event along with Window.Open, the link no longer opens in a new window (but the color change happens). How can I achieve this v...

how to rewrite this this inline javascript with jquery?

I have the following markup with inline javascript and would like to change it to Jquery. Any help would be appreciated. <a title="823557" href="/PhotoGallery.asp?ProductCode=471823557" id="product_photo_zoom_url"> <img border="0" onload="vZoom.add(this, '/v/vspfiles/photos/471823557-2.jpg');" alt="823557" src="/v/vspfiles/photos/471823...

dynamic html buttons in javascript code

hey so im using javascript, jqeury, and html here. basically i have a dynamic number of buttons that are being created, and will each call a function using unique variables. the variables are held in a json variable. here is the code as it is: var box = "<font size=\"2\">The following assassins are in your current location:<br/><ta...

How do I use Node.js modules?

Hey, I recently installed Node.js on a fresh Linode box, and I think I'm in a weird situation where I can't use require() to load any thrid party modules. I've installed npm and have successfully installed modules via npm, but whenever I try to require one of the modules (or just some of my own code in the same directory), Node throws a...