javascript

Background image resizing to fit

I'm trying to make the background image as professional as possible so I'm thinking it's best to resize it based on the size of the browser or the resolution (not sure what's usually used, but I think browser size makes sense here). The idea is if the viewer screen is small, the background image gets smaller, and as the screen gets bigge...

Is it considered bad practice or unethical to append always used small jQuery plugins to the end of a common.js file?

A lot of my jQuery projects use sub menus. I'm a firm believer of using the hoverIntent plugin over jQuery's native hover(), for usability reasons (and to prevent events being fired by accident by the user). Because this plugin is used on every page of my site, and because it is only 8 lines minified, I just appended it to the end of my...

Trying to populate a jQuery FullCalendar from Grails

I'm trying to display a jQuery FullCalendar (http://arshaw.com/fullcalendar) inside a Grails GSP and to populate it from a controller. Here is the Javascript code to initialize my calendar: $('#container').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, ed...

Calling functions with setTimeout()

Simply put... why does setTimeout('playNote('+currentaudio.id+', '+noteTime+')', delay); work perfectly, calling the function after the the specified delay, but setTimeout(playNote(currentaudio.id,noteTime), delay); calls the function playNote all at the same time? (these setTimeout()s are in a for loop) or, if my explanation is...

Loading external sites into Iframe dynamically - is there a better way??

I've build an application which currently uses an Iframe to load external sites. This method is really slowing my application down - taking up to 5 seconds to load a page that might load in <1sec in it's own tab/window. Is there any solution I can implement which will let get more speed?!? Thanks! EDIT: Here's the code I'm currently...

Can't get value of designMode IFRAME

I can't retrieve the contents of an iframe, when designmode = 'on'. Here is my code: val = $("#frame").val(); I've tried everything, and nothing works, help? ...

using JavaScript how to capture all XMLHttpRequest onreadystatechange ?

Hi all, I am developing an extension from Chrome and I need to do some changes to the page code after it is loaded. but the problem is window.onload event isn't useful nowadays where almost any website is using AJAX. You can't assume that all content is already loaded because window.onload is fired before all AJAX request has done loadin...

Conditional Comment to run for all browsers except IE 8 and below

how can i write a conditional comment for scripts that should run for all browsers except IE 8 and below? i saw Conditional comment for 'Except IE8' ? but how do i adapt it to include scripts files not inline scripts? ...

It is possible to use a custom IP with the geolocation feature of Google Chrome?

Hi, today i tested the geolocation system implement by google on Chrome, with this page: http://www.browsergeolocation.com/ , the think is, is possible to use this service but without my ip?, i mean, using other ip to retrive the geo info. PS 1: I know the are many sites that offer iptogeo services, but they only give you a very general...

parse a textarea in substrings based on line breaks in Javascript

I have a text area that I need to parse. Each new line needs to be pulled out and an operation needs to be performed on it. After the operation is done the operation needs to be run on the next line. This is what I have at the moment. I know the indexOf search won't work because it's searching character by character. function conve...

php's curl.... but in javascript?

Hello, I'm wondering if anyone has come across any libraries in javascript that can emulate something like php's cURL? ...

Dynamic Ad Code Replacing Page

I have an application that uses a mobile ad provider; the way ad provider works is that I make a request on the server side, the provider returns me the mark-up and I include that on my site. In order to make the load page faster (which is a requirement that I don't control), I have an AJAX call to my server which then makes the call to...

Javascript help

Hi guys, could you please help me with this code? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Welcome to Daily News</title> <s...

Form is not submitting via javascript on a button

My website has been created with a CSS/HTML frame work that has been integrated into an ASP.NET website. Inside of a ContentPlaceHolder, I have a simple login form. The catch is that I am using the onclick event of an image to submit the form. It normally works pretty straight forward, but this time I am having an issue. <div id="lo...

Problem with loop on IE8

Hi i have this javascript function function test(){ var count = 0; var date1 = $('#alternatestartdate').val(); var date2 = $('#alternateenddate').val(); var startDate = new Date(date1); var endDate = new Date(date2); var loop = true; whi...

Can you you show a grey hint in an HTML text box with CSS alone?

You see these text input boxes from time to time on the web: a grey label is shown inside the box, but once you type there, the grey text disappears. This page even has one: the "Title" field behaves exactly like that. So, questions: Is there a standard term for this? I'm really struggling to find anything on google Can it be done wit...

Nginx upload progress with Rails

I am having some trouble getting an upload progress working for my file upload. new.html.erb <%= form_for @image, (onsubmit="openProgressBar(); return true;"), :html => { :multipart => true } do |f| %> <%= f.file_field :photo %> </p> div> <div class="actions"> <%= f.submit %> </div> <br /> <iframe id="u...

ajax returning php/javascript code

Hi guys, I was playing around with AJAX. If I do echo "helllo" in the PHP file it works fine. However, if I do something like echo "<script language=Javascript> alert('hi');</script>"; in the PHP file, the alert() does not come up. Anyone know if I'm doing anything wrong? example: in my html file i've got this <div id='somet...

link to external javascript file in a subdirectory from a web host

I have my index.html at the root of my web host, and my javascript file is in a directory(JavaScript) which is also at the root. How can I link my index to the js file? I did the following, but it's not working: <script type="text/javascript" src="JavaScript/filename.js"></script> in the head. It works when I do the inline javascript ...

how to pass variable to jquery event?

$(".addcart").click(function(){ $("input[name='items']:checked").each(function() { //doing something }); }); I'm trying to create a common class onclick of which I'm doing something. Is there a way I can make "items" a variable, I mean Can I pass checkbox name to this event. ...