javascript

HTML generation in JS code

I'd like to know your thoughts about HTML code generation in my JS code. I just think that the html.push("<tag>" + something + "</tag>") style pretty annoying. I've already tried something with templates inside my HTML file (and put some placeholders therein), and then used its content to a replace the placeholders to my real values. B...

Resize an SWF when loading it with SWFObject

I'm loading an SWF movie into an HTML page using SWFObject. I want to resize this SWF dynamically. How can SWFObject help? I'm sure I don't have to write my own solution. ...

Javascript chop/slice/trim off last character in string

I have a string 12345.00 would like it to return 12345.0 I have looked at trim but looks only to trim whitespace and slice which I don't see how this would work. Any suggs? ...

adding an error / removing an error in jquery.validate

Hi, I'm trying to implement a generic way of adding remote validation to xVal / jquery.validate There are only two unsolved questions left: How do I "manually" mark a form element as invalid and add an error message to it from my own javascript code? How do I remove remove the error message at a later time without removing any other...

What's a easy way to truncate an array with Jquery?

Linq has a convenient operator method called Take() to return a given number of elements in anything that implements IEnumerable. Is there anything similar in jQuery for working with arrays? ...

Is there a way to specify reference or value type arguments in javascript functions?

It would be cooler if you could ...

Javascript Scorm 1.2 API

Hi, I need to make an existing LMS Scorm 1.2 compliant (only the basic calls). Does anyone know of any free scripts for this out there so as not to have to write this from scratch? Thanks! Michael ...

What college has good coverage on Design Patterns, CSS, and JavaScript?

A cousin is going to college, probably in computer science, and he asked me where is a good school to go. I told him some schools and current topics in CS, he asked about them and I was wondering, are there some colleges that actually put Design Patterns, CSS, JavaScript, Ajax, DOM Scripting, XML, and web architecture in their required ...

Replace string in javascript array

Hello. I have an array in javascript. This array has strings that contains commas (","). I want all commas to be removed from this array. Can this be done ? Thanks. ...

Why is my script failing w3c validation?

I have this piece of code: <script language="javascript" type="text/jscript"> document.write("<img src='http://dm.leadgenesys.com/jpgp.lgt?en=P.........TP_Q=&amp;amp;ur=' + escape(document.referrer) + '' border='0' alt='no alt' />"); </script> and... when I try to validate it, I'm given this error: document type does not allow ...

javascript : having trouble passing form values to javascript and processing it to httprequest

I have a java servlet (class) which populates form data. //encode string for special characters String encodedString = URLEncoder.encode(desc, "UTF-8"); out_table.append("<form name=\"masinsert"+id+"\" method=\"GET\" action=\"MASInsert2\">\n"); out_table.append("<input type=hidden id=\"partnumber"+id+"\" name=\"partnumber"+...

Is it normal to have a short delay after .innerHTML = xmlhttp.responseText; ?

Is it normal to have a short delay after .innerHTML = xmlhttp.responseText; ? Delay aproxamilty 1 sec. after xmlhttp.readyState==4. Using firefox 3.0.10 ...

Animated line graph in Javascript?

I'd like to do a line-graph on a web-page using Javascript. I want it to be animated so that when the page loads, the line is slowly "drawn" onto the graph. I've managed to get a static graph working, using flot, however I'm unsure how to animate it. It would be half my job done to just make it draw a line half-way along the graph, bu...

Is there other way to make a WYSIWYG editor on a webpage without using the designmode property?

Is it true that most WYSIWYG editors on a webpage is by using the designmode property? Is there any other method besides using this method? (is designmode first available on IE and other browsers added it too later on?) ...

Adjusting elements based on scrollHeight using JQuery

Here's what i have so far: function loadOff(){ $(document).ready(function(){ $("#eLoader").ajaxStop(function(){ $(this).hide(); $("#eventsContent").show(); var h = document.body.scrollHeight; $("#bodyBackground").css("height",h+100+"px"); $("#sidePanel1").css("height",h-105+100+"px"); ...

X,Y coordinates seem to be generated from the middle of an object instead of the top left in flash

I am converting a room editor I had made in AJAX to Flash where users can move furniture around where they want, but I am running into some issues with the x,y coordinates. With the Javascript/AJAX setup, I recorded the X,Y coordinates of the furniture image, and it worked fine from the top left corner of the image. However, now trying...

is using TinyMCE a top choice for WYSIWYG editor on a webpage? What are good alternatives?

is using TinyMCE a top choice for WYSIWYG editor on a webpage? What are good alternatives? some comparison seems to show that TinyMCE is one of the most compatible across browsers: http://geniisoft.com/showcase.nsf/WebEditors ...

JavaScript Closures and Memory Leaks

I read in Jquery in Action that memory leaks can result from javascript closures. "Unintended closures can have unintended consequences. For example, circular references can lead to memory leaks. A classic example of this is the creation of DOM elements that refer back to closure variables, preventing those variables from being reclaime...

Need a Java and Javascript diff tool written in Java

We need an accurate diff utility for Java and Javascript files, written in Java. It should be invokable from within an Eclipse (version 3.2 or 3.3) application. Preferably we need the Java source code for this utility also. The utility should be able to compare two files (old and new, say) and determine the following accurately: Numbe...

jQuery - Check Checkbox based on Select Value

Hi, I'm after a small jQuery script that will check the appropriate check box based on what value is selected in a Select element input. eg. If the value 'P.J. Gallagher's Drummoyne' is selected in select#CAT_Custom_70944 then input#drummoyne-list.checkbox is checked. The same goes for all the options in the select list: 'P.J. Galla...