javascript

Ignoring/canceling browser drag for JavaScript drag & drop

Hi guys, I'm implementing a drag & drop script in (plain) JavaScript. All good, except one thing. For example, in Firefox (probably not only there), if you drag an object the second time, it is getting dragged as a built-in browser feature (for easy drag & drop image saving to desktop, for example, I think). Well this kind of ruins my s...

How do I change the text of a span element in javascript

If I have a span, say: <span id="myspan"> hereismytext </span> How do I use javascript to change "hereismytext" to "newtext" ...

Factoring in SEO on a Flash Site

There have been many debates about this topic already here, but none of them fully answered my question so I figured I would pose it and hope I get one or two decent answers. We're planning on relaunching our company website in the next few months. Our current site, for the most part, is text-driven and because of this we rank very well...

is an html form handler possible or currently exist, if so how would I use it?

So, what I want is basically to attach a javascript handler to a form, that whenever one of the form input boxes / select boxes is changed or clicked on, this handler would be called with the id of the element that was changed. The reason I was wondering about this is because I already have this form that has about 50 input boxes, and I...

html basic standards document for peer review.

Where can I find the most basic html "coding standard document". This is for an individual unfamiliar with html to peer review the document. Looked around w3c but validators and detailed information is not what I'm looking for. Also looking for JavaScript and CSS documents. Thanks. ...

In jQuery, how to attach events to dynamic html elements?

Suppose I have some jQuery code that attaches an event handler to all elements with class "myclass". For example: $(function(){ $(".myclass").click( function() { // do something }); }); And my html might be as follows: <a class="myclass" href="#">test1</a> <a class="myclass" href="#">test2</a> <a class="myclass" href=...

How to use mozilla Rhino behind firewall?

Normally if I run the following the following command in the rhino shell, mbp001:rhino1_7R2 user$ java -jar js.jar Rhino 1.7 release 2 2009 03 22 js> readUrl("http://www.google.com") It will return the resultant html markups. However, if I runs it behind a firewall, it will throw an exception (because it is unable to reach the host)...

Best way to prevent a javascript function from executing while it already is or another one is?

I'm using jquery and what I'm doing is binding the toggle method to a number of buttons on a webpage. It looks something like this $('.button').toggle(function(){ // first function }, function(){ // second function }); However, there are animation in both of those functions. So a user can click the button while the first or second...

jQuery Array Question

I'm rather new to jQuery and I'm trying to make a cool little menu effect where when the user hovers over a element (#nav li) it will animate to a larger width, which will reveal the full background image. Each of the menu items has a ID to explicitly set a width (since they are all different in size), so #nav1 might be 80px whereas #nav...

Javascript onclientclick help?

I have OnClientClick="return confirm('Make Payment?');" tied to an asp:Button. It works fine, however, prior to popping up this confirm tho, I need to check if a textbox contains a value... How can I do this? I need a function to return false if the textbox value is null or empty, otherwise i want to present the user with the c...

'innerText' works in IE, but not in Firefox

I have some JavaScript code that works in IE containing the following: myElement.innerText = "foo"; However, it seems that the 'innerText' property does not work in Firefox. Is there some Firefox equivalent? Or is there a more generic, cross browser property that can be used? ...

Automagically Minify CSS and Javascript on Upload

Hey guys, Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm currently u...

TinyMCE file upload, generic syntax error.

When using TinyMCE's "Ajax File Manager" plugin file upload, I get the following error when I hit the upload button: "Syntax error: missing ; before statement" Everything else seems to be working okay. Any ideas? (Permission settings somewhere maybe?) image: http://www.oddrealm.com/ebay/tinymce.jpg EDIT: Here's some more info: If the...

Invisibly sending data back to server - without generating postback.

I've got a simple function in javascript on my asp.net page that writes some data to hidden field on a page. To get this data the form must be sent back to server. The problem is that submitting the form results in reloading the page and I wouldn't like my client to experience unnecessary postback. So i assume that it can be made using A...

Setting window.location.hash to null in Safari 3+ causes it to be set to #

Setting window.location.hash to null in Safari 3+ causes it to be set to #, e.g. window.location.hash = '#foo' => #foo But, window.location.hash = null => # Same occurs if you set it to an empty string instead of null. Behavior definitely occurs in Safari 3 + 4, and does not occur in FF 3 or 4. Any workarounds for this? Gran...

Using jQuery, the onclick event, and Adobe AIR

I'm building an Adobe AIR application with a bit of jQuery to dynamically change the display of the application. Part of the display includes links with Javascript functions on the onclick event except, in the application, onclick is disregarded when the div has been manipulated by jQuery. I've confirmed that onclick works fine when it's...

Sorting a JSON object in Javascript

I've been looking for a while and want a way to sort a JSON object like this: { method: 'artist.getInfo', artist: 'Green Day', format: 'json', api_key: 'fa3af76b9396d0091c9c41ebe3c63716' } and sort is alphabetically by name to get: { api_key: 'fa3af76b9396d0091c9c41ebe3c63716', artist: 'Green Day', format:...

Getting an Ajax call to return into my Javascript context

Given an instantiated JavaScript object/class can I make an Ajax call from that class and have the returning success function callback into the caller's object? Currently I can get the callback to return back into the object, but I lose the "this" property, which kills the state of my object function BaseConsoleHelper() { this._iconInd...

Replacing jquery each with for

I apologize in advance if this is a stupid question that betrays my lack of understanding of javascript/programming. I've been using $.each to do iterations for a while now, but I keep on hearing people say to use native JS for to do loops. I'm very concerned about performance but I am not sure if it's always possible to replace $.each...

Using jquery to get per row totals and grand total of table

So the short version of this is: Can I traverse only the elements within the matched element of the selectors before the each()? Or is there a simpler way of getting what I want without an each() loop? I thought this would be much easier, which makes me think I'm just missing some fundamental principle of element traversing with jquer...