javascript

Use variables or "inject" jquery selectors when chaining?

Hi, is it better to do this (regarding performance, not readability...): $('a.updateCartButton').click(function() { $('form[name=updateCartForm]').attr('action', $(this).attr('href') + '#' + $('img[id^=iconUpdateArticle]').attr('id')).submit(); return false; }); or this: $('a.updateCartButton').click(function() { var actionHre...

Do you take into consideration DialUp connections still?

I'm working on a web application that has a lot to download (javascript, images, videos, etc), and I was wondering how many people still consider dial up while developing large web applications? Is there a rule of thumb that you use to determine the individual page sizes? (i.e. home page must be less than 200k) ...

IE 8: JS call to new Image() fails when the code is run in a popup window

I've run into a strange Internet Explorer 8 issue. I have the following Javascript: var img = new Image(); img.src = "http://something.com/images/something.gif"; It works just fine when I'm running it in its own window but when it's run in a pop up window it fails saying 'Image is not defined'. This only happens in Internet Explorer....

Getting a Flash Movie with Javascript in IE

I have a flash movie that I need to get with javascript. Here is how I embed it using swf object: <div id="ap1_mod"></div> <script type="text/javascript"> var flashvars = { mp3Path: "stop", artistName : "", trackName : "" }; var params = { codebase: 'http://download.macromedia.com/pub/shockwave/cabs/fla...

How to get FormCheck jQuery script set up and working.

I am trying to use FormCheck for MooTools to validate a basic contact form I am planning to build. The problem is I can't seem to set up the script to work at all =( If anyone knows about FormCheck or MooTools and can add any pointers they would all be greatly recieved. My page: http://is.gd/1p1Ys Thanks Ryan ...

facebook xfbml after login, get user info through javascript

i use xfbml facebook login button to authenticate user . after users entered correct password. may i know how do i use FB.Facebook.apiClient or any related javascript to get user logined information? ...

Are there any really basic tutorials for how to build a simple rich text editor?

I want to write my own rich text editor with javascript or jquery. I don't know where to start, so as bare bones as possible is ideal. EDIT: To response to the comment about reinventing the wheel - the reason why I want to this is because 1] some features I want to implement aren't available even in TinyMCE. 2] I have an idea to upgrade...

can a textNode have a childNode which is an elementNode ?

Say,is the following possible: textNode.appendChild(elementNode); elementNode refers to those with nodeType=1 textNode refers to those with nodeType=2 It's not easy to produce. The reason I ask this is that I find a function that adds a cite link to the end of a quotation: function displayCitations() { var quotes = document.getE...

Draggable Clone of Image in Javascript

I am trying to make an image draggable but drag a clone of the image (rather than the image itself). The copy seems to be working fine but the onmousemove trigger doesn't seem to fire until the onmouseup trigger has fired. I wouldn't think this is how things worked. Working Code Below var Draggable = { obj : null, clone : null, ...

Changing Image SRC Based on SELECT

I have a select tag that is populated with a list of files each time the page loads. I would like the image to change to the selected file each time one is clicked in the select input. This is what I have right now, and it does not work properly. However, when it is clicked, the image and text are visible/hidden as they should be. Any he...

FORCE limit the value of a column.

How do you force a limit total? Is this correct syntax? or am I missing something cause it's exceeding total number from my calculation. switch (ddlVal) { case RequestTypes["Sick"]: case RequestTypes["Late"]: case RequestTypes["Jury Duty"]: tbEffectiveDate.disabled = false; ddlTotalHoursEffect.disabled = true; tbFromDate....

Javascript calling public method from private one within same object ...

Can I call public method from within private one: var myObject = function() { var p = 'private var'; function private_method1() { // can I call public mehtod "public_method1" from this(private_method1) one and if yes HOW? } return { public_method1: function() { // do stuff here } }; } (); ...

button javasript works on IE but not firefox window.navigate()

<input type="button" value="Back" onClick="window.navigate('http://www.google.com')"&gt; This works on IE8, but not firefox or opera. Anyone know why and how to fix it? ...

2 questions about drag and drop with Javascript

Hello, I'm trying to be able to drag random highlighted text or images on a random page that is not written by me, thus I cannot simply wrap the text in a div and make it draggable. Is there any way to get highlighted text or images on a random page, like say Yahoo, and drop it into a container that can recognize what was being dropped...

Can I get some advice on JavaScript delegates?

I'm rusty with delegates and closures in JavaScript, and think I came across a situation where I'd like to try to use one or both. I have a web app that behaves a lot like a forms app, with fields hitting a server to change data on every onBlur or onChange (depending on the form element). I use ASP.NET 3.5's Web Services and jQuery to d...

Refering to controls through javascript function

Hi, I have a radiobutton column in a gridview, inside many nested asp tables. I want radios enable two buttons upon click. so I added this the following function an javascript but it cannot find my controls although I turned ClientIDMode="Static" for those buttons. It returns null. <asp:GridView ID="gridView_stLists" runat="server" Auto...

How to run function of parent window when child window closes?

I have asked this question before and the problem was half solved in the sense I was helped to find out that Javascript has some tough security in place. What I learnt: A parent Window opens a child window. The child window redirects to a different domain and gets redirected back. It attempts to fire off a function of the parent window ...

To break up your jQuery code into functions, do you do it the same way as in JavaScript?

I've been writing some jQuery functions that have JavaScript variables and looping, etc inside them - they're becoming long and hard to read. If I want to break them up, how would I do that? $(".x").click(function () { var i=0; for (i=0;i<50;i++) { if ($("#x"+i).is(':hidden')) { $("#x"...

Cross-browser implementation of "HTTP Streaming" (push) AJAX pattern

Client request web page from server. Clent then requests for extra calculations to be done; server performs series of calculations and sends partial results as soon as they are available (text format, each line contains separate full item). Client updates web page (with JavaScript and DOM) using information provided by server. This seem...

Need help understanding problem alternating visibility of a DIV by dynamically switching classes

This code attempts to dynamically switch the class of the StateContainer div from StateOne to StateTwo to alternate the visibility of the DIV. When I run it, I always see the following both before and after clicking the button. Visible first Visible first Visible first Visible first Would appreciate any suggestions for why this code ...