javascript

What is the prefered method to preload images <img> and why?

What is the best method to preload images <img> and why? I want to show images on link's hover i can't use images in CSS background so i can't use CSS sprite. but i want to preload all images while page load . which are add as <img>. ...

Need a Javascript calendar that should only show next dates corresponding to the date in textbox

Hi all i would like to show the pop-up calendar when i click on calendar in my application. Previously i will have a date in my text-box that may be any date in the current year. What i need is if my date in text-box is some thing like 01/03/2008.. I would like to show only the next dates after that, and i would like to disable all the ...

Help with some jQuery in a Wordpress Loop

I am making a custom archive page, that will display the list of posts with their excerpt, and a button that when clicked toggles the rest of the post content. I have it working with this code, except that it toggles EVERY post content lol because in the loop they all get the class you know what I mean? Can you help me fin a way to do t...

How to trigger a select box to open when a link is pressed. (HTML/iPhone/Javascript)

Basically, I'm building a mobile site with LOTS of content. I have a header, then a menu with three buttons that I need to open select menus so that the iPhone's select wheel will appear. Any ideas? So far my searching says not possible... ...

Javascript "..." waiting dot looping with interval

Instead of using an animated gif, I would like to instead have text in a span: Waiting Waiting. Waiting.. Waiting... I would like to loop through each and then return to the first in an infinite loop. I would also like to control the interval to speed up or slow it down. I'd like to have my HTML to be: <p>Waiting<span id="dots"></...

window.print not working with opera browser

Hi, I am trying to open a print dialog box in Opera browser using javascript code as <script language=javascript> window.print(); //This is working in IE, Netscape, Firefox, but not working in Opera </script> where as if I am using the following code Opera browser understands and able to open print dialog box <input type="button" va...

How to reduce my repeated jQuery code

Hi - first post here at this great website! I would like to reduce the amount of code for the following, espacially as there are more parts I need to add in the future - I'm sure there must be an easy way but I'm just not seeing it. Thanks for your help! $(document).ready(function(){ $(function(){ $('#iqdrive').click(...

Math with jQuery /Javascript

Hello, I have dynamic input boxes with values of dates like this <input size="30" id="date_one" value="21/03/2011" type="text"> <input size="30" id="date_two" value="14/08/2010" type="text"> I want to calculate difference between these two dates. i.e. How many days remaining ? Is it possible with jQuery to do this kind of math...

Where can I put this code, containing both Javascript and Ruby, so that it can be used by different views in my RoR app?

I have some javascript code that is used in a few different pages in my website. The code changes depending on some parameters, which are set in the Ruby on Rails controller. For example: acontroller.rb def aview @notes = get_notes end aview.html.erb (the actual code is much longer) <% @notes.each do |note| %> var <%=note[...

JQuery add class to parent element

Hi. I have to set a class name on a (li) element. This script find all the (a) elements in the list, and creates a click event. jQuery("#" + ElementID).find(TagName).click(function () { GetPageByUrl(jQuery(this).attr("href")); jQuery(this).parent().addClass('yourClass'); //ChangeSelectedMenuItem(this); return false; })...

Minimal Javascript to embed twitter feed into my html ?

What is the minimal Javascript to embed twitter feed into my html ? ...

Actual IE6 Png fix

What png fix method is the most actual today? Lite-weight, with background-repeat and background-position support. ...

Help me choose between Javascript, jQuery, or AJAX.

Hi there, before i start of with anything i know that jQuery and Ajax are the JS frameworks and it is nothing but JavaScript itself. I started to learn Javascript few days ago, and then i realized the need to learn the AJAX and then suddenly i felt jQuery will be the better solution, heck i am confused here, i cannot go three at a time n...

Nanite and NodeJS

I'm working on a code that requires to send Nanite requests to actors. Was it possible to publish requests from another amqp client? I'm using http://github.com/ry/node-amqp So basically I wanted to publish nanite commands from a NodeJS app, Here's some code: connection.addListener('ready', function () { puts("connected to " + conne...

Add items to a table from a thread in asp.net

I have a HTML table which I add items to from javascript on an ASP.NET callback when a button is clicked. HTML: <%@ Page Language="C#" CodeFile="Hello5.aspx.cs" Inherits="ClientCallback" %> <html> <head> <script> function AddResult() { GetResults("blah", ""); } function UpdateTable(itemText) { var ...

Hiding text as font-face fallback?

Hello, I am trying to code a clean html5 website. I am using the html5 boilerplate as the base of the website. It comes with modernizr. For the page title I am using text-shadow and font-face and have set up a small css fallback via modernizr (when one of the features is not available, a png image will be shown as background). So the ...

notifying the server (XMLHttpRequest?) on the onunload event?

Is it possible to notify a server (make a single HTTP request with a bit of data, response is unimportant) when client leaves the page? I'm actually using python-tornado comet application with javascript constantly keeping a request connection to the server (which gets closed and re-opened on event. Based off this: https://launchpad.net...

window.location.hash not working in Chrome/Safari

Hi all, I have the following code on my website, which basically checks to see if there is a hash in the URL, and if there is then it triggers a click on a tab. This works fine apart from in Chrome/Safari - any ideas how I can fix this? jQuery(document).ready(function() { if(window.location.hash){ $("a#viewapart").trigger(...

Cannot retrive style using js

<html> <head> <style> #menu{ color :red; } </style> </head> <body> <div id="menu"> ABCXTZ </div> </body> <script> a = document.getElementById('menu'); alert(a.style.color); </script> </html What i retrive just is a empty box. ...

Javascript works in Chrome, Safari and Opera but not Firefox

Site here. Basically the box in the middle doesn't generate random string from my database in Firefox as it does in the other browsers. I can't seem to find the problem, my JS skills aren't amazing. I haven't tested it in IE as I don't have access to it right now. Any ideas? Thank you! ...