javascript

How do I automatically update hundreds of images in an HTML page using jquery?

I have an HTML page where I want to refresh a lot of images every 30 seconds after the HTML page has been downloaded. I understand how to do this with Jquery and a single image, but I want to use about 200 custom urls to determine the current image to display for over 200 images. I need to find an efficient way to have jquery call the cu...

jQuery photo carousel (that looks like a real carousel)?

I am on the lookout for a jQuery photo carousel that can display 3 images at a time, and circle through x amount of photos (and when reaching the last, starting with the first photo again). I made a quick mock-up of what i am looking fore - see it here. So there is 3 photos vissible, the middle one beeing the 'main' one and a bit bigge...

Return Statement in JS Constructors

What is the effect of a return statement in the body of JavaScript function when it's used as a constructor for a new object(with 'new' keyword)? ...

Can't get YUI animations to wait until the first has finished

Hi there, I have 3 animations that run when I load my page. A header descends from the top and a footer ascends from the bottom. Also, my main logo goes from fully transparent to fully opaque. I'm using the YUI framework for the animations. My problem is that they all happen at the same time. I'd like the header & footer animations to...

Passing a variable to javascript via a link.

My website has a javascript variable (addselectedsubdivision) that loads a neighborhood name from a box on the left to a box on the right. I was hoping I could build a link and then us PHP to add the subdivision letter, neighborhood, and city so that when you click on the link it goes right to this page and loads the neighborhood name i...

Problem with sending "SetCookie" first in php code

According to this manual: http://us2.php.net/setcookie I have to set the cookie before anything else. Here is my cookie code: if (isset($_COOKIE['watched_ads'])){ $expir = time()+1728000; //20 days $ad_arr = unserialize($_COOKIE['watched_ads']); $arr_elem = count($ad_arr); if (in_array($ad_id, $ad_arr) == FALSE){ ...

How do I know this function is return empty..and how do I show it??

Hi I am not familiar with javascripts...so cant understand how do I check which variable return empty?? if tweet is there then it fill with tweets but if not then it wont show up. but I want know which varible is fills the container and if I want show "there is no tweets for you" then where will I add that?? $(document).ready(function()...

Ajax auto-populate from field when another form field is filled out

Has anyone used javascript/ajax to take data from one form field and put it into another? I'm trying to create a form that when one text input is filled out a second is auto-populated with the first letter of the word that is in the first text input. I'm thinking I can limit the second text input to one character to help get the desire...

Can't focus fancybox iframe input

So I'm using fancybox to load up a login iframe, and I would like it onComplete to bring focus to the username field. If someone could take a look at this code and let me know what's wrong, that'd be great. Gracias. /* Function to resize the height of the fancybox window */ (function($){ $.fn.resize = function(width, height) { if (!wi...

JavaScript inheritance

Hi, Douglas Crockford seems to like the following inheritance approach: if (typeof Object.create !== 'function') { Object.create = function (o) { function F() {} F.prototype = o; return new F(); }; } newObject = Object.create(oldObject); It looks OK to me, but how does it differ from John Resig's simpl...

Using arrays in Jquery

Here is a code: <input type="button" id="array[1]" value="Value1" /> <input type="button" id="array[2]" value="Value2" /> <input type="button" id="array[3]" value="Value3" /> And I want to do something like that: $('#array').click(function() { id = this.id; $.ajax({ here goes type, url, data and else });...

What is this weird script I found on facebook?

Not so much a question to help my own programming, but I found this page on facebook with a cool illusion and a page that says "to see the real illusion, copy and paste this code into your address bar" and there is a script: DISCLAIMER: DO NOT RUN THE FOLLOWING CODE javascript:(function(){a='app129556453726651_fsDszN'; b='app1295564537...

How to find the center point on the page with JavaScript?

How can I find the (x,y) point of the center of the viewable area of the browser? I am using jQuery, if there are any good jQuery helper functions for this. ...

Jquery functions. Should I hold it in one file or is it okay to intersperse it?

So, I have a lot of php files where I use jquery functions. Do I need to create a seperate .js file for all jquery functions or I can put it together with php files or it actually doesn't matter at all? ...

cross-domain javascript

I am producing a javascript-based widget. Nothing complex just a few document.writes... When I place it inline in the page it renders fine in all browsers. When I place it externally and load it via <script src="http://example.com/path/to/site"/&gt; it fails to render in Firefox and IE but not Chrome. Anyone know why and a possible w...

How to put buttons in a html page in a jQuery dialog

eHello everyone,the following is my code to display a jquery dialog window with a closing button "OK": <script type="text/javascript"> $(function(){ $("#dialog").dialog({ autoOpen:false, bgiframe:true, buttons: { "OK": function() { $(this).dialog("close"); } }, width:500, height: 350, ...

how to get dynamically created elements width and apply style to that?

Hi, I am creating an li element dynamically like this: $(data).find('slide').each(function(numSlide){ var slideLink = $(this).attr('link'); var slideimage = $(this).children('slideimage').text(); var slidedesc = $(this).children('slidedesc').text(); $('.slider ul').append('<li><a href="'+slideLink+'"><img src="'+root+"images/to...

Using jQuery to auto-populate a form field from another form field

Has anyone used jquery to take data from one form field and put it into another? I'm trying to create a form that when one text input is filled out a second is auto-populated with the first letter of the word that is in the first text input. I'm thinking I can limit the second text input to one character to help get the desired result, b...

Write a serverside c++/openGL App, that is accessible via JavaScript

Hi, I am currently having an idea where I want to save an image from a c++/openGL application on demand from a browser. So basically I would like to run the application itself on the server and have a simple communication layer like this: JS -> tell application to do calculations (and maybe pass a string or some simple data) applicatio...

What is view port in HTML.

What is view port in html and give some example to access the view port details. ...