javascript

Should I combine .css files with php to reduce http requests?

I was thinking today, as I linked a webpage to 3 external .css files: "This is too many HTTP requests!" I got to wondering if I should be using php to combine these files into one? Or should I just import all three into the <head> with <style> tags? I found one relevant link on the interwebs: Suture CSS or JavaScript Files to Reduce H...

How to make this work in all other browsers other than Firefox

Hi I have a select list with numbers in it. These numbers go from 0 to 30. I want to hide numbers based on the number of days apart from the current date and the date the user set. So if today is July 28th 2010 and they Set July 29th 2010 it should only show "0". If it was July 28th 2010 and they set September 20th 2010 it should sho...

Why is it a bad idea to allow these in JavaScript == , != , ++ , --

I was checking out JSLint, and some of the rules piqued my interest. Particularly this: Disallow == and != Disallow ++ and -- Why is it a bad idea to disallow these? I understand the first part, basically it wants me to do === instead of ==. I don't understand why though. I understand the difference between the two, I ...

Why does Firefox waits until a javascript function is finished to start another function?

Hi, we are developing a web application using GWT in the front end. In GWT we make calls to the server by appending javascript code as stated below: public native static void call(int requestId, String url, ICall handler) /*-{ var callback = "callback" + requestId; //Create a script element. var script = document.createE...

Ajax query to my webservices is returning xml in my json

Hi I am having this exact problem as raised in this question http://stackoverflow.com/questions/1121559/asp-net-json-web-service-always-return-the-json-response-wrapped-in-xml It's late and I have been sitting in this chair for 10 hours now trying to get ajax and json to work and all I got was deeply frustrated. So does anyone know ...

Yahoo Web Analytics Upgrade

Yahoo is forcing an upgrade to their current version of Yahoo Web Analytics tracking code (from version 4 to version 5). The deadline for upgrading is the end of this month. Here is the message within the interface: In 2009, we migrated all of our client accounts to a new Data Center in order to improving the overall security an...

setInterval / clearInterval Issue inside it's scope

I have the following code, and it works fine until i hit the the #play button. I'm assuming it's because the var intID is set in another place and it's not in the same scope when i window.clearInterval() it... how do I fix this? BTW, this is the Google Maps API Version 3 function intervalTrigger(){ return window.setInterval(fu...

Javascript confirmation dialog box takes three clicks of "cancel" to close.

The following code is guilty of generating this unusual problem: <script type="text/javascript"> $(document).ready(function () { $('.deleteRow').click(function (event) { event.preventDefault(); if (confirm('Delete?')) { var $t...

Triggering a file download without any server request

Greetings, I'm working on a JS-based application that does some complex work and logs some information (actually, up to hundreds of lines) on a <div>. My goal is to have a "Save log" button that triggers the browser's download dialog to save the contents of my logging <div>. More concisely, these are the requirements for this feature:...

"this" doesn't work when binding functions to events inside a Javascript class

First off, I know I can copy "this" on instantiation, but that doesn't work here. Basically I'm writing something to track people interacting with Youtube videos. I got this working fine for one video at a time. But I want it to work on pages with multiple Youtube videos as well, so I converted the code to a class so I can create a new...

JavaScript/JQuery event handler problem

Been playing around a bit with JavaScript/JQuery, and made a "shy" button, instead its just a p-tag with a word. It works ok, except the bool goDown doesn't seem to change, so it always goes down. What's wrong with my code? Also JavaScript debugging in VS2010 doesn't seem to be working very good, is this a known problem? Thanks in adv...

UJS partial rendering in Rails 3

Hi, I'm struggling to get my head around how to implement UJS in Rails (specifically, Rails 3 with jQuery). I've worked through Ryan's Railscast, and can follow what to do when submitting a form via AJAX, but I'm having trouble extending this concept to attaching a javascript function to a html element in my view files. Ultimately, I wo...

Resize div that's inside another div

Hi! I have a div that is the body of my site, inside that div I put a div on the left side (to have a vertical menu) http://www.freeimagehosting.net/uploads/117f79fa0e.png http://www.freeimagehosting.net/uploads/4569a5f550.jpg My question is, how can I make the menu div follow up to the bottom of the body div so that it doesn't look ...

HTML select field updating another

I'm trying to create a webpage to merge vendors in our database and have a page with two select fields like this: <select name="vendor" id="vendor_select_from"> <option value="Apple" id="id0">Apple</option> <option value="Vector Resources, Inc" id="id1">Vector Resources, Inc</option> <option value="Dell, Inc." id="id2">De...

strategy to split up php output into smaller outputs (ajax, php) (nested ajax calls, ajax within ajax?)

Hi, I don't know the correct terminology to search for the solution. Please suggest a strategy to break up the php output into small chunks and pass them stepwise to ajax's responseText. The project is an ajax webpage that takes a text string (lastname) and passes it to a php program. The php code takes the last name and randomly fet...

TinyMCE hint text

I'm using Remy Sharp's jQuery plugin to display hints in text boxes. I'd like to do the same with TinyMCE - display a hint, like "Type some text here.", and when the user focuses the TinyMCE editor, that text should go away. If the editor is empty (no text entered), then on blur the text should be visible again. Is there a jQuery plugi...

Extend document DOM for iframes

I already have a set of functions I use to extend the document (i.e. bind/unbind). So I can do stuff like: document.bind('load',someAction,{}) But it doesn't work if I do: $('some_iframe').contentWindow.document.bind(...) And apparently, $('some_iframe').contentWindow.document.prototype doesn't exist. EDIT: Here is the code breakdown: ...

Accessing an element in a frame using a jQuery reference to the frame

I have a frame that's nested in an iFrame. <iframe>..<frameset..><frame id="report">. I have a jQuery reference, myFrame, to the report frame. I don't have control to the html. I am trying to modify an element in the frame. contents() doesn't work with frames. I tried using a context like myFrame.document & myFrame.contentDocument but t...

How to cut the string in javascript so that it fits exactly two lines & add ... at the end

Hi, I have a requirement where in i have to display the text for two lines & add ... if its overflowing My div Width is fixed.(Even height can be considered as fixed). Actual text looks like this: 1 Lorem Ipsum is simply dummy text of the printing and typesetting industry. 2 Lorem Ipsum is simply text of the printing and types ind...

How can I search a .txt file for a keyword in Javascript?

What's the correct syntax to search a .txt file for a keyword in JavaScript? EDIT: I'm working with a subset of JavaScript called UnityScript in a program called Unity3D. It outputs .exe programs. Here's an example of UnityScript: import System.IO; function ReadFile () { var sr = new StreamReader(Application.dataPath + "/" + readF...