javascript

IE6 Covering Div

I have a Google Map on one webpage where I want to disable both scrolling and zooming. I accomplish this by having an empty DIV element with absolute positioning cover the map area. Firefox/Chrome work fine, but IE6 doesn't really care about this DIV. For some reason, it just lets me drag the map. I set the DIVs background color to gree...

How to access a DIV on a page being accessed by an iFrame?

I have a print function using JavaScript that prints just the contents of the iFrame and not the page the iFrame is in. What I want to do is have a DIV or something in the page being access through the iFrame that will go visible when you print and have a legend on it and then it will go back to invisible once the page is printed? Any ...

How best to import an Object (obtained from a JSON decode) into a MooTools Class?

Hello, I have a class called User defined using MooTools Class. This class contains a getter called fullName (which manipulates firstName and lastName). var User = new Class({ initialize:function(firstName, lastName){ this.firstName = firstName; this.lastName = lastName; }, fullName:function(){ return this.firstName + ' ' + th...

Default value for function paramater?

So I've been doing this for as long as I can remember, but I'm curious if this is really what I should be doing. You write a function that takes a parameter, so you anticipate it to have a value, but if it doesn't, you have a good reason to default it, to say zero. What I currently do is write a helper function: function foo() { retur...

Block access to JavaScript file

Let's say I have a JavaScript file... using .htaccess is there a way I can make it so a user can NOT look inside the JavaScript file? ...

dropdown javascript menus

I am trying to create a dropdown javascript menu with jquery. I am using hide() and show(). I made it so that when you click on a menu item it shows but I cannot figure out how to make it so that when you click on anything other than the menu it will hide. I have seen it done on multiple sites before. How do you do it? ...

jquery start dragging object when clicked on the other

Hi all, here's the deal: I'm trying to make a colorpicker act much like in Photoshop, so I have a background image of a color picker (rainbow-like image 200x200 px) and a circle trigger inside of it. So, if i attach a draggable UI to a circle: $('#rainbow-color-picker .circle').draggable({containment: 'parent'}); Works great. But he...

Which has higher performance java or javascript?

Since now javascript gets compiled to machine code by browsers. I was wondering which programming language gets better performance between java and javascript. I'm thinking of writing a 3d browser FPS or MMO and am trying to decide between the two. Also what are thoughts on compatibility? It seems like with java and opengl I could ...

canvas.toDataURL() in adobe air

is it possible to use canvas.toDataURL() in adobe air 2.0 ? when i try im getting Error: SECURITY_ERR: DOM Exception 18 ...

jQuery version of Dojo's Stateful?

Does anyone know of any plugins written in jQuery that are similar to Dojo's Stateful? See: http://www.dojotoolkit.org/api/dojo/Stateful.html Regards, Scott D Brooks ...

Inserting spans and classes around characters in a string of raw text

I have a string of raw text which looks something like this: 1 . . 3 . 4 . | A . A . N . | 1 . 1 . . . I sadly cannot access the source code, but need to add a span with a class to each of those characters, so that the outputted HTML would look something like this: <span class="1">1</span> . . <span class="3">3</span> . <span class...

Disable link to the current page in navigation

I have a pretty standard navigation for a website. The main navigation is a ul, with several nested ul's. I'm basically just wanting to dynamically disable a link when the user is already on that page. So if I'm on the home page, the home page link needs to be disabled. If I'm on the contact page, the contact page link needs to be disab...

html form button vs input type="submit" vs this.submit()?

What is the proper standards compliant semantic way to have a submit button on a form? I don't need images or backgrounds in the buttons, just simple text, maybe a gradient background with curved corners (using CSS3). These are the ways I know of: <input type="submit" value="click here"/> <button>click here</button> <span class="but...

Tutorial or Book on implementing a metalanguage in Javascript

I've been working in Javascript and PHP but I find that the hardest part isn't the implementation but the design of the webapp architecture [as usual . . .] In that direction, I wanted to create a sort of meta-language that takes PHP code as input but outputs JavaScript code thus making the design and implementation phase less painful [s...

Detect return key in textarea and if a certain string is present write a line to textarea [javascript]

Basically have a large textarea, and I want to be able to do a few things with it; Detect when the user presses "enter" to go to a new line, and When enter is pressed, if the line contains a certain string let's say "hello", a line would be written to the textarea that reads "hello to you." I cannot, for the life of me, detect a str...

Javascript function properties

Why is it that I can do the following in javascript: function a() {}; a.foo = 30; Specifically, why can I set a property on the function a? After all, I cannot do this: var a = 20; a.foo = 30; ...

json data returns invalid label error

I'm using Ajax file upload function with its javascript / jQuery library. When uploading a file, I keep getting this error message: SyntaxError: invalid label This is my JS script: jQuery('.uploadImage').live('click',function() { ajaxFileUpload(); }); (...) function ajaxFileUpload(){ jQuery.ajaxFileUpload({ ...

Problems executing an XMLHttpRequest from file:// to http://

I'm trying to do an XMLHttpRequest from a local file (file://) using JQuery.ajax to something on http:// and from what I can see it looks like the request is going out (the success callback is called and Firebug shows the request) but there is simply no response coming back. Here's basically what I'm doing: $.ajax({ url: "http://st...

Make an event happen in child iframe to the parent window in JavaScript?

I don't have access to this iframe's source directly, so I would like to do this, if it's possibly this way. I have an iframe generated by JS: <iframe name="temp_iframe" width="100%" height="95%" src="'+the_url+'"></iframe> And inside is a submit button and a cancel button. The submit button works fine, but I want the cancel button t...

remove check boxes with certain values

I have the following snippet of code of which I do not have access to the markup to add id's/classes. What I need to do is remove any checkboxes that have certain values. There are 10 or so values that if any of the checkboxes have these values they need to be removed from the markup. In addition to that I also need to remove its associ...