javascript

What is the preferred way to do a CSS rollover?

When setting up a rollover effect in HTML, are there any benefits (or pitfalls) to doing it in CSS vs. JavaScript? Are there any performance or code maintainability issues I should be aware of with either approach? ...

jQuery UI droppables - changing the image that's dropped

I'm working with jQuery UI's droppables and am wondering what the best way to make the dropped clone use a different IMG SRC than the item being dropped. In the photo manager demo there, the thumbnail gets dropped into a slot that's the same size. I'd like to drop a large image into a small slot, and as such I need its clone to use my t...

Is there a (built-in) way in JavaScript to check if a string is a valid number?

I'm hoping there's something in the same conceptual space as the old VB6 IsNumeric() function? ...

Java Script 2 D Arrays allocation

I want to allocate a 2 D Array in Java Script. I want do some thing similar to this in JavaScript typedef struct { int itemA, int itemB, string testC }myStruc; myStruct MyArray [100]; How to do this ? ...

Which wysiwyg editor works best on Adobe AIR?

There are tons of free wysiwyg editors you can embed in web pages. I'm looking for something that is easiest to embed into an adobe air app. Means something that works in webkit and is easy to get the content from with javascript. ...

Element-Enhancing Javascript in ASP.NET Master Pages

Hi all. I have run in to a bit of a problem and I have done a bit of digging, but struggling to come up with a conclusive answer/fix. Basically, I have some javascript (created by a 3rd party) that does some whizzbang stuff to page elements to make them look pretty. The code works great on single pages (i.e. no master), however, when I...

Javascript tabs showing two different sets of information with same core variable types

So basically, I have two tabs which contain regular and special e-mails. In order to get e-mails, you have to click on a calendar date and AJAX will then query the database for the regular e-mails and special e-mails. There is a next and previous button to navigate through the results gotten for the selected date. The problem I have is t...

Are there any recent Lua to JavaScript converters or interpreters somewhere?

I need to find a good Lua to JavaScript converter; lua2js on luaforge.org is out of date (3 or so years old and looks like it doesn't work on Lua 5.1) and I haven't yet found anything on Google. Does anyone have any experience with any other converters out there? It should work on Lua 5.1 and preferably be .NET based, but .NET is not a ...

Favorite Web Form Validation Technique

What is everyone's favorite way to sanitize user data? I've been using Javascript, but have recently required something more secure (people can turn it off, after all), so I was looking at Flex, but thought I'd ask the community what they thought. ...

Why does everyone like jQuery more than prototype/script.aculo.us or MooTools or whatever?

It seems that jQuery has taken the throne for JavaScript frameworks and I was wondering exactly why. Is there a technical reason for this or is it just that they have evangelists? I have been really happy with using Prototype myself. Should I use jQuery for my next project? ...

Is there a jQuery equivalent of MooTools' Element() constructor?

I am going to be starting a javascript reporting engine for my website, and have started some prototyping using MooTools. I really like being able to do things like this: function showLeagues(leagues) { var leagueList = $("leagues"); leagueList.empty(); for(var i = 0; i<leagues.length; ++i) { var listItem = getLeagueLi...

Is there a way to have content from an IFRAME overflow onto the parent frame?

I have a UI widget that needs to be put in an IFRAME both for performance reasons and so we can syndicate it out to affiliate sites easily. The UI for the widget includes tool-tips that display over the top of other page content. See screenshot below or go to the site to see it in action. Is there any way to make content from within the...

Java Script to edit page content on the fly

I'm writing an article about editing pages in order to hand pick what you really want to print. There are many tools (like "Print What you like") but I also found this script. Anyone knows anything about it? I haven't found any kind of documentation or references. javascript:document.body.contentEditable='true'; document.designMode='on'...

Re-center Modal Popup with Javascript

I have a modal popup that initially shows some content but expands a div if a checkbox is selected. The modal expands correctly but doesn't recenter unless you scroll up or down. Is there a javascript event I can tack on to my javascript function to recenter the entire modal? ...

What is the most efficient way to get the first item from an associative array in JavaScript?

I need to get just the first item (actually, just the first key) off a rather large associative array in JavaScript. Here's how I'm doing it currently (using jQuery): getKey = function (data) { var firstKey; $.each(data, function (key, val) { firstKey = key; return false; }); return firstKey; }; Just gu...

A way to prevent a mobile browser from downloading and displaying images

Hey, Is there a simple way to prevent browser from downloading and displaying images, best would be via some magic style tag or javasctipe. The thing is, I'd like to tweak the company's website a bit to be more usable via mobile devices. The company is a gaming one, there's like 5MBs of images on it's main page (and those can't be touc...

JavaScript: case-insensitive search

Hi everybody, I'm trying to get a case-insensitive Search with two String in JavaScript working. Normally it would be like this: var string="Stackoverflow is the BEST"; var result= string.search(/best/i); alert(result); The /i flag would be for case-insensitive. But I need to search for a second string, without the flag it works per...

Reading the dynamically changed value of an HtmlInputHidden in ASP.NET

I got a simple page with a HtmlInputHidden field. I use a javascript to update that value and when posting back the page i want to read the value of that HtmlInputHidden field. The Value property of that HtmlInputHidden field is on postback the default value (the value it had when the page got created, not the value reflected through th...

Problem selecting HTML elements with xpath in Internet Explorer

I'm trying to select a specific HTML element in a document, for firefox i just use: xpathobj = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); which works fine. However when i try the IE equivilent: xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load(document); xmlDoc.set...

Best Practice: include( or <script src="

I have minified my javascript and my css. Now, Which is better? <script type="text/javascript"> <? $r = file_get_contents('min.js'); if($r) echo $r; ?> </script> OR <script type="text/javascript" src="min.js"></script> Same question for CSS. If the answer is 'sometimes because browsers fetch files simultaneously?' Which brow...