javascript

How do I change the background color with Javascript?

Anyone know a simple method to swap the background color of a webpage using javascript? ...

When is JavaScript's eval() not evil?

I'm writing some JavaScript to parse user-entered functions (for spreadsheet-like functionality). Having parsed the formula I could convert it into JavaScript and run eval() on it to yield the result. However, I've always shied away from using eval() if I can avoid it because it's evil (and, rightly or wrongly, I've always thought it is ...

Internet explorer hanging issue

I'm currently experiencing an intermediate problem with some inherited client side javascript. Every so often the users' experience a browser hang with the cursor becoming an egg timer and then the browser failing to respond. I'm having real difficulty in determining where the issue is arising from. Short of disabling large chunks of j...

Forms and no Cookies - elegant way to submit forms

Hoi! I have a form I wish to submit, but I need to add the PHPSESSID, because some clients allow no cookies. There are several javascript functions on my page which displays a list of users (search, sort, open details), the page is generated by PHP. Now I am looking for an elegant way to have the PHPSESSID included in every submit of ...

Wanted: acts_as_nested_set, AJAX drag and drop tutorial

Can anyone suggest a tutorial or sample code that implements a nested set (or similar ordered tree structure) with associated Javascript that facilitates drag and drop? I'm looking for both the display code (view) as well as the AJAX backend controller which writes the tree to the database on change. I want it to represent a multi-layer...

Prevent js alert() from pausing timers

So I made some timers for a quiz. The thing is, I just realized when I put javascript: alert("blah"); in the address, the popup alert box pauses my timer. Which is very unwanted in a quiz. I don't think there is any way to stop this behaviour... but I'll ask anyway. If there is not, mind suggesting what should I do? ...

Is there a textarea and or rich text editor (like FCKEditor) which allows the user to follow links (click them with the left mouse button) that render in them while entering?

For example, the markdown editor in stackoverflow does not allow you to 'click' the links you add as your entering data into the editor. I would like to render a text area pre-populated with some links to lab results that the user can choose to review while making their comments. ...

Is there a good in-browser code editor?

We've all seen in-browser rich text editors, which allow you to edit colored/styled text in a WYSIWYG manner. But what about code editors, which automatically highlight code based on language rules as you type? Think Eclipse in a textarea (but without the refactoring support). Do such things exist? I imagine scaling would be a problem -...

FCKeditor Plugin Issues

I am a complete beginner trying to develop for FCKeditor so please bear with me here. I have been tasked with developing a custom plugin that will allow users to browse a specific set of images that the user uploads. Essentially the user first attaches images, then uses the FCKeditor to insert those images. So I have my plugin directory...

XUL - sidebar buttons that load new pages in main browser window.

I'm learning how to make a firefox extension. I have created a xul and overlay file that makes a sidebar in my browser. I'm trying to put buttons in my sidebar that load different pages within the main browser window. I'm not sure how to access the main browser window and load a new url within it. I have here a simple button and script t...

Testing HTML/CSS/Javascript skills when hiring

When hiring a front-end developer, what specific skills and practices should you test for? What is a good metric for evaluating their skill in HTML, CSS and Javascript? Obviously, table-less semantic HTML and pure CSS layout are probably the key skills. But what about specific techniques? Should he/she be able to effortlessly mock up a ...

Silverlight Hosted in Winforms

I would like to host a silverlight control in winforms via a winforms browser, but for it to work I need some way for the forms to talk to the silverlight, and also the other way around. Would it be possible to somehow have the two interact with each other using JavaScript as a middleman? I.e., have the form speak to the browser's java...

JQuery Select Box and Loop Help

Hi All, Thanks for reading. I'm a bit new to jQuery, and am trying to make a script I can include in all my websites to solve a problem that always drives me crazy... The problem: Select boxes with long options get cut off in Internet Explorer. For example, these select boxes: http://discoverfire.com/test/select.php In Firefox they ar...

img onload doesn't work well in IE7

I have an img tag in my webapp that uses the onload handler to resize the image: <img onLoad="SizeImage(this);" src="foo" > This works fine in Firefox 3, but fails in IE7 because the image object being passed to the SizeImage() function has a width and height of 0 for some reason -- maybe IE calls the function before it finishes loadi...

Asp.NET Regular Expression Validator (Password Strength)

I have a validation control that has the following expression: (?=(.*\\d.*){2,})(?=(.*\\w.*){2,})(?=(.*\\W.*){1,}).{8,} That's a password with atleast 2 digits, 2 alpha characters, 1 non-alphanumeric and 8 character minimum. Unfortunately this doesn't seem to be cross-browser compliant. This validation works perfectly in Firefox but ...

How do I select a mouse hovered object with JQuery?

I have a list of dynamically generated div-tags with a class-attribute but no id. How do I select the one which is hovered with mouse cursor? In CSS it would be like this: div.classname:hover Oh, and I wouldn't like to use any extra Jquery-plugins. ...

Javascript fake dictionarys

I've declared Javascript arrays in such a way that I could then access them by a key, but it was a long time ago, and I've forgotten how I did it. Basically, I have two fields I want to store, a unique key, and its value. I know there is a way to do it.. something like: var jsArray = new {key: 'test test', value: 'value value'}, ...

Are hidden fields on child window inaccessible from parent window

I have asp.net form that contains fields. When I access this window, my javascript functions can access the fields via the DOM with the getElementById() method and when I postpack to the server I am receiving the updates made by the client. However, when I launch the form as a child window using Telerik's RadWindow control, the javasc...

Can you Instantiate an Object Instance from JSON in .NET?

Since Object Initializers are very similar to JSON, and now there are Anonymous Types in .NET. It would be cool to be able to take a string, such as JSON, and create an Anonymous Object that represents the JSON string. Use Object Initializers to create an Anonymous Type: var person = new { FirstName = "Chris", LastName = "Johns...

Is there an idiom for letting an element scroll with the page only until it hits the top of the browser?

Basically I am looking to accomplish something similar to the affect that yelp uses to have the map follow you down the page on their search results page but I'd rather have it be instantaneous rather than have it catch up a few seconds after you scroll. I also don't want to just set the position to "fixed" because I want it to scroll u...