javascript

Javascript if box checked.

Hello, i have this form for adding videos. Now, there's a input field for "title" and i want that to disappear if you have pressed on the checkbox "tryout". How should i do that in JS.. i use jquery. ...

Should this JavaScript thing be an object or a singleton class?

Hi, I'm working on a JavaScript software that bears resemblance to Windows. It has a desktop, taskbar, etc. and I'm wondering whether I should make the desktop a class or an object? I'm thinking about making a process list array that holds all instances of objects. It would hold an instance of desktop. Does this make sense? Or should I...

Capturing Shift key activity using JavaScript

I am using JavaScript and jQuery and would like to call a function when the user releases the Shift key. The code I came up with works in all the browsers I've tested so far, however the following warning appears in the error console using Firefox 3.5.7. I've tried jQuery 1.2.6, 1.3.2 and 1.4.1. Warning: The 'charCode' property of a ...

Hide link URL with JavaScript

How do I hide a URL? The URL is a mouse over an image. I want to hide the URL for the image when the user mouse over the image. Right now when I mouse over the image, I can clearly see the URL on the status bar, not the location bar. echo'<a href="images/myImage-'.$i.'.jpg?day='.$i.'" onclick="swap(this); change(this); return false;">';...

Exactly clone an object in javascript

Hi, I tried to exactly clone an object in javascript. I know the following solution using jquery: var newObject = jQuery.extend({}, oldObject); // Or var newObject = jQuery.extend(true, {}, oldObject); but the problem with that is, that the objects type gets lost: var MyClass = function(param1, param2) { alert(param1.a + param2.a...

seperate javascript, iframe/parent

Hi, I have a big flaw in my idea and was wondering if anyone cold help me. I have a script which i have wrote that runs on a page nicely. on that page there is an iframe, from which it's content is from a temporary web page ( temporary / dynamically generated for preview purposes ) which is in full working order ( i.e. it runs all it's j...

Jquery: Select menu to show and hide certain div elements

Hello, I'm looking to create a select menu that shows and hide certain divs based on the selected option; something like this: <select name="choose_colors" id="color_selector"> <option value="select_color">Select color</option> <option value="red">Choose Red</option> <option value="blue">Choose Blue</option> <option value="gree...

Can somebody explain this Javascript method?

Original source: http://twitter.com/tobeytailor/status/8998006366 (x=[].reverse)() === window // true I've noticed that this behavior affects all the native types. What exactly is happening here? ...

'Neatest' way of adding javascript to a page footer in asp.net

Whenever i want to add a javascript library programatically, say jquery for example, it generally involves making sure there is a placeholder at the footer of my page, then calling a codebehind method that will take a link to the src as a parameter and return an htmlgeneric control, which is then added to this placeholder. Is this still...

Javascript to prevent invalid user input

I have written a set of javascript functions that allow me to validate user input on a form. I only want to accept valid input, and impose the following behaviour: When a user enters an invalid form, I display an alert and inform them that the value entered is incorrect. Crucially, the original (valid) value in the form is not changed. ...

Changing mouse icon thru javascript

I am developing paintbrush application in javasript using Canvas Object. I want to change my own mouse cursor when the mouse pointer comes inside Canvas object. How to load my own icon? ...

Using domready for AJAX calls

Is there a way to know that the elements are on a document before I try to access them with JQuery? Code Snippet: var s = new AjaxCall(someurl); s.oncomplete = function(response) { var container = $('container_id'); container.innerHTML = response; var ul = $('some_id'); } The response is some HTML returned by the Ajax ca...

How to get the value of a multiple option dropdown?

Say I have this dropdown: <select name="color" multiple="multiple"> <option value="red">Red</option> <option value="green">Green</option> <option value="blue">Blue</option> </select> So basically more than 1 color can be selected. What I'd like is that if a user selects red, and then clicks green, i'd like a function to be called each...

Plupload works with Ruby on Rails?

I tried following the example at: http://www.plupload.com/example_custom.php But in the request, file is not sent to the method of the controller, only the name. Maybe I need to set in the configuration of Plupload, something like 'multipart = true' Any idea? ...

JavaScript - Navigate to a Named Anchor

Hello, I have an named HTML anchor tag that works like a bookmark. This tag is defined as: <a name="myLocation"></a> I need to be able to jump to this link via JavaScript. How do I jump to a location in my HTML page from JavaScript? Thank you! ...

Prototype Add Class to Class

I have a few div's like this in my page: <div class="listing-type-list catalog-listing"> I would like to append a class to the div when I hover over it then remove it when I mouseout? How can this be done with prototype? ...

HTML / Javascript Selectable Timeline

Where can I find an off-the-shelf selectable HTML and Javacript timeline for choosing date ranges? ...

HTML script element localhost uri

Hi, This may seem like a silly question, but consider the following use of the 'script' element to import an external javascript file: <script src="http://localhost:8085/myscript.js" type="text/javascript" > Given that this is a url and not a file path, would this be evaluated server side or client side? If evaluated client side, t...

check for IE and display another page

I have a web app which is currently not rendering in IE. For the time being, I want to check for IE and display another page for IE visitors. How can I do it? Do I need javascript or PHP? ...

how to run a javascript function asynchronously, without using setTimeout?

its a server side Javascript (rhino engine), so setTimeout is not available. how to run a function asynchronously? ...