javascript

Javascript or JQuery mindmap plugin

Does anyone know of a nice looking Ajax mind mapping module I can use? I'm interested in something that can save the minmaps to SQL to be entered into a database, however I'm happy to add that bit of functionality if required, it's the shiny-ness that I'm looking for. ...

Declaring variables using the keyword this in js

Hi, Is there a difference between this: var onClick = function() { var image = ..... $.post("/..../...", null, function(data) { myCallback(data, image); } ); } and var onClick = function() { this.image = ..... $.post("/..../...", null, function(data) { myCallback(data, this.image); } ); } I am using the 'th...

Where can I find a good JavaScript/HTML AutoSuggest example

I am looking for a good example implementation of a JavaScript/HTML AutoSuggest input box to get me started. What I am trying to implement will behave "Exactly" like the Tags input box here on stackoverflow. If it helps I am using jQuery to perform Ajax request. I am finding examples to help me implement this however I am concerned w...

document.readystate = undefined

From external JS script I use document.readystate to determine whether the document is loaded. If its not loaded I attach Onload event listner. However when I run the script from IEPRO (similar to FF greasemonkey) on IE7 document.readystate returns 'undefined'. (I guess that IE7PRO runs the script after the document has loaded already)...

javascript - (deep) copying an array using jquery

Hello, I need to copy an (ordered, not associative) array of objects. I'm using jquery. I initially tried jquery.extend({}, myArray) but, naturally, this gives me back an object, where I need an array (really love jquery.extend, by the way). So, what's the best way to copy an array? ...

What Cross-Browser issues have you faced?

While developing for multiple sets of browsers, what issues have you faced while development due to differences in browser implementation? To start with I am listing some of those which i faced: A text node in Firefox allows only 4K data. So an XML Ajax response gets split up into multiple text child nodes instead of only one node. It...

How do I create a regular expression that disallows symbols?

Hey, I got a question regarding regexp in general. I'm currently building a register form where you can enter the full name (given name and family name) however I cant use [a-zA-Z] as a validation check because that would exclude everyone with a "foreign" character. What is the best way to make sure that they don't enter a symbol, in bo...

JavaScript: Cancelling events cross browser

I am implementing a floating pop-up help control in an asp.net web site, and i'm using JQuery to implement the whizzy bits. The pop up is made visible by clicking on a link, the link also has an href poining to another page to support users with JavaScript disabled. I added "return false;" to the end of the Javascript string in the onCl...

Changing CSS Values with Javascript

It's easy to set inline CSS values with javascript. If I want to change the width and I have html like this: <div style="width: 10px"></div> All I need to do is: document.getElementById('id').style.width = value; It will change the inline stylesheet values. Normally this isn't a problem, because the inline style overrides the style...

Can canvas tag be used to draw on top of other items on a page?

Can an HTML canvas tag be positioned over other html content on a page? For example, will something the following CSS declaration make a canvas tag do what I expect it to? canvas.mycanvas { position: absolute; background: transparent; z-index: 10; top: 10px; left: 10px; } ...

Is there any way to track selection range in iframe's designMode?

Hi, I've been experimenting with this for a while but didn't get anything working well — is there any way to track mouseups and selections in iframe's designMode, preferably in a cross-browser compatible mode? ...

Validate Multiple Emails Comma Separated with javascript

I want to validate a string which can be an email or multiple emails separated by commas. For example: [email protected] -> TRUE bill -> FALSE [email protected],[email protected]" -> TRUE [email protected],[email protected], bob" -> false bob,[email protected],[email protected]" -> false I came ou...

Javascript functions Math.round(0) vs toFixed(0) and browser inconsistencies

Edit: To clarify, the problem is how to round a number to the nearest integer. i.e. 0.5 should round to 1 and 2.5 shoud round to 3. Consider the following code: <html><head></head><body style="font-family:courier"> <script> for (var i=0;i<3;i++){ var num = i + 0.50; var output = num + " " + Math.round(num) + " " + num.toFixed(0)...

How do I download javascript string as a file

Application requests KML data through AJAX from server. This data is stored in javascript variables, and displayed in Google Earth plugin. In javascript, how do I provide a link to download the KML data stored in javascript variable (as a string) without requiring a request back to server? This link: http://forum.mootools.net/viewto...

jquery - scope of function passed to $().grep

It seems that "myFunction" in the following example loses its scope. $().grep(myArray, myFunction) By this, I mean that it no longer has access to the "this" of the scope it was defined in, and "this" becomes the window object. Can anyone explain why this is and if there's a handy way to preserve myFunction's scope? This javascript c...

At what point do you perform front-end optimization?

I'm talking about things like page/stylesheet caching, minifying javascript, etc. Half of me thinks it's better to do these things as early as possible while still in development so I can be consciously aware of more realistic speed and response issues as well as interacting with something that more closely resembles what will be deploy...

Web programming: Get rid of Javascript or convince me to dive into this mess

I'm looking for alternatives to client side Javascript in web programming, because for me this language just plain sucks. I mean I am indeed impressed of the capabilities jquery or other javascript-frameworks accomplish, but for myself programming in javascript is a pain in the rump. I would like to replace it without sacrifice functiona...

Zend_From_File upload, but file element is stored inside a js modal window! Not working

I'm developing an application ased on zend framework, and the problem that it is giving to me is this, when i echo zend file element like this: <div id="add_video" title="Add Video"> <?php echo $this->form->video_title;?> <?php echo $this->form->video_thumb;?> <?php echo $this->form->video_video;?> </div> And i have this i...

Why can't my onclick handler find its parent node?

Why does the onclick handler below trigger an "elem.parentNode is not a function" error? <html> <head> <script type="text/javascript"> function getParent(elem) { var parent = elem.parentNode(); } </script> </head> <body> <div style="border: solid black 2px"> <span onclick="getParent(this)">hello</...

jQuery modal window removes elements from my form

jQuery, when i use it to create a modal window which contains form elemets, it takes out those elements when i submit the form. example of the form: <form enctype="multipart/form-data" action="/system/article/add/" class="from" method="post"> <label for="article_title" class="required">Title:</label> <input class="formfiel...