javascript

document.readyState == "complete" is always false. The state is always "interactive".

I am wiring a startup script JavaScript function on Page_Load to fire like so: ScriptManager.RegisterStartupScript(Me, GetType(Page), "page_init", "page_init();", True) This function calls a couple of different functions to setup the page. One of those functions checks the document.readyState and makes sure it's "complete". This deals...

Preferred JavaScript mode for emacs? Is it js2-mode from Yegge?

There are a couple JavaScript modes out there: js2-mode by Steve Yegge javascript.el by Karl Landström. espresso? Something else? Does anyone have a recommendation on which to use? ...

change img src using select

I'm using the select form to navigate around a page. <form name="form"> <select name="menu1" onChange="MM_jumpMenu('parent',this,1)"> <option value="#" selected>SELECT</option> <option value="#a">location A</option> <option value="#b">location B</option> </form> I'd like the select form to have the added functionality of changing...

JavaScript Date Object's month index begins with 0!

My goal is to convert a timestamp from MySQL into a JavaScript Date object in an efficient manner. Here is my current snippet that converts the MySQL timestamp into a formatted date in PHP: <?php // formats timestamp into following format: 2009, 7, 30 $date = date("Y, n, j", strtotime($row["date"])); ?> I am then using this $date va...

What is a good jQuery lightbox clone?

It must be: easily skinnable with css be able to handle forms and not just images be well documented Any suggestions welcome Many thanks ...

jQuery Cycle Plugin Breaks in IE6 with background image

I'm using the jQuery Cycle plugin along with the tutorial here: Net Tuts tutorial "building-an-auto-scrolling-slideshow-that-works-with-and-without-javascript" It all works good if I give my containing <div> a background color, but as soon as I apply a background via url(), my slide navigation which was originally positioned absolutely ...

How to fake an event in mootools?

Sample code: <div id="first">first div</div> <div id="second">second div, click here or on the previous it's the same</div> Suppose I set an event onclick on the first div that alerts the div's content. How do I call that event? In example clicking on the second div I'd like it to call the click event of the first div and alert('firs...

Generics in asp.net ajax?

I've seen someone use a Sys.StringBuilder in asp.net ajax, is it possible to use generics as well? I essentially have a List of comment objects (That contains a datetime, a string (Title), and another string (content)) and am trying to work out the best way to handle the data when it is returned to the javascript from a web service. Am I...

Complicated Javascript Calculation

I've got a fairly large table that needs to have a total on the right side and bottom for daily totals. I've been able to get the side to total correctly, but not the bottom. I may be thinking too little of this, but currently I have this: (Yes, I know it's not correct and doesn't work. I was testing) script: HorizVertiCalc = functi...

JavaScript setTimeout() slows down under heavy load

I've created a script that fades the background color of an element. I use setTimeout() to make an incremental change to the color every 5 ms. The script works great if I'm just fading the background color of one thing at a time, but if I've got, say, 50 elements I'm all fading at once, the speed is much slower than 5 ms because of all t...

Why is JavaScript sometimes viewed as a low level language?

Inspired by this question. I commonly see people referring to JavaScript as a low level language, especially among users of GWT and similar toolkits. My question is: why? If you use one of those toolkits, you're cutting yourself from some of the features that make JavaScript so nice to program in: functions as objects, dynamic typing,...

Opera problem with javascript on submit

I have an input element with onchange="do_something()". When I am typing and hit the enter key it executes correctly (do_something first, submit then) on Firefox and Chromium (not tested in IE and Safari), however in Opera it doesn't (it submits immediately). I tried using a delay like this: <form action="." method="POST" onsubmit="wait...

Override IE email auto formatting.

Hello, Our site makes use of a web based, rich-text editor FreeTextBox. In IE, not FF, if a user types in something like: someone@blah IE automatically creates a mailto hyperlink. I have tested this with other text editors out there and the story is the same with all of them. So the question can I override this browser behavior s...

Problem with triggering an Ajax POST on the onblur() event

I have an Ajax problem. There is an input field and I want to submit the changed value on the onblur() event. It all works fine except that there is an irritating flicker. I type in the new value and click away. The old value then flashes back before the value changes to the new value... This is how I am doing it. I attach an onblur f...

jCrop / PHP upload problem

Hey guys, I am not very familiar with jquery & am trying to implement jCrop + upload via PHP. I found exactly what I needed ( http://webdevcodex.com/mashup-application-image-uploader-cropper-using-jquery-php/ ) and attempted to use it but the script is not going past step 6 (from the demo code). I am able to upload an image to the fold...

IE not loading the whole page HTML source code

My blog loads normally on Google Chrome and FireFox, but not on IE, when viewing the source code I figured out that it stops reading html at a certain amount. at the end of the source code I find this </script> <div class='clear'></div> <span class='widget-item-control'> <span class I agree it's a big webpage (the last line is 1338) ...

Javascript to Redirect Parent Window and Close Popup...in that order

One of my pages launches a popup with javascript. Inside the popup there is a link that uses window.opener.location to redirect the parent window. I want the popup to wait until the parent window is completely loaded, and then close itself. The link is to an external page, so using the parent window to close the child window is not an...

How can I force the browser to redraw while my script is doing some heavy processing?

I am using the innerHTML property to modify a DIV dynamically, to report on a process that takes a few seconds to finish. The problem is that on Firefox the page is not actually re-rendered to reflect that change until after the script has finished. This makes the app feel sluggish. Is there a way to make sure that changes to the HTML sh...

Two separate script tags for Google Analytics?

Does anyone know why Google Analytics requires two separate script tags? Specifically, their instructions advise users to embed the following snippet of code into a web page for tracking purposes: <!-- Google Analytics --> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http:...

JQuery toggle Q&A: individual Q&As don't operate correctly unless you click on Open All/Close All first

I have a Q&A list with "Open All/Close All" at the top with individual open and close image buttons that toggle when clicked. That works fine. Then follow individual Q&As, and each has its own open and close image. If you click on "Open All/Close All" first, as soon as the page loads, and then click on the individual Q&A open/close im...