javascript

How can I dynamically load and execute all of the Javascript files in a directory?

I'm making a very simple content-management system in Javascript. It uses plugins which are individual .js files which live in a "modules" folder. Currently I'm loading them with JQuery's getScript() function, but I have to manually define the list of available modules. Is there any way to dynamically load the list of Javascript files s...

Rails: generate .js file at runtime

Hello, I've a .js file in my public/javascript folder, I want to include a dynamicaly generated value in this file. Is it possible to have a .js file dynamicaly generated, something like public/javascript/my_javascript.js.erb Thanks ...

parsing numbers in a javascript array

Hi I have a string of numbers separated by commas, "100,200,300,400,500" that I'm splitting into an array using the javascript split function: var data = []; data = dataString.split(","); I'm trying to parse the values of the array using parseFloat and then store them back into the array. I'd then like to add up the numbers in the ar...

Using JavaScript how do I pass a value from a parent form to a child form?

I have tried numerous things to no avail. What I am trying to do sounds simple...ASP.NET 2.0. A person enters data in 1 field. I then want them to click a button, this opens a form using window.open whereby the data they entered should be display. All the examples I find are either incomplete or go from child to parent instead of paren...

a simple regexp

The regexp has to remove ,id or id, in read and unread. GM_setValue('unreadids', unreadids.replace(new RegExp('('+id+',)|(,'+id+')', 'i'),'')); GM_setValue('readids', readids.replace(new RegExp('('+id+',)|(,'+id+')', 'i'), '')); In RX Toolkit, (,1|1,) for a test, ,1 or ,1 is replaced with nothing. In real life... http://userscripts....

Deselect all options in Multiple Select with 1 option

Hello, I currently have the following js code function clearMulti(option) { var i; var select = document.getElementById(option.parentNode.id); for(i=1;i<select.options.length;i++) { select.options[i].selected=false; } } and function clearAllOpt(select) { select.options[0].selected = false; } T...

clear html select option group

I know you can clear options by doing the following: dropDownList.options.length = 0; Is there a way to clear option groups? Seems like the only way is to remove nodes one at a time. ...

Building an array out of values from another array

This is a follow up from a question of mine that was just answered concerning parsing numbers in an array. I have an array, data[], with numbers that I'd like to use in a calculation and then put the resulting values into another array. So say data[0] = 100. I'd like to find a percentage using the calculatin, (data[0]/dataSum*100).toF...

Javascript Event for Select element Selection

Hi everyone, I'm looking to find the Javascript Event I need to put into jQuery's .bind function in order to have the function triggered when a selection is made from a <select> element. At the moment I'm using .bind('change',function() { ...}) but I need the event to trigger when the selected option is chosen again. Any suggestions? ...

Globally disable Ext JS Animations

I'm testing an intranet web app in the iPad but the animations to open "windows" and show message boxes are horribly slow. I've tried setting the global Ext.enableFx to false, and confirmed that flag is still false after page load in Firebug. The animations are still occurring though so I must be doing something wrong. Thanks... ...

Some encoded Javascript that I need in plain text

Hey, I'm having some issues trying to decode some javascript.. I have no idea what kind of encoding this is.. i tried base 64 decoders etc. If you can please help me out with this, here's a fragment of the code: \x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x61\x70\x70\x34\x39\x34\x39\x3 Any ways I can get plain text from that? Thanks! ...

Why are most marketing tags (Omniture, XE, etc) written with document.write()?

Considering the negative effects of document.write(), why are most tracking/marketing tags written using document.write()? I've thought about it quite a bit, and the only respectable idea I've come up with is that by writing it client side, we're guaranteed the browser won't try to cache the resource. Is that it? Any other ideas? ...

How to send web browser a loading page, then some time later a results page

I've wasted at least a half day of my company's time searching the Internet for an answer and I'm getting wrapped around the axle here. I can't figure out the difference between all the different technology choices (long polling, ajax streaming, comet, XMPP, etc.) and I can't get a simple hello world example working on my PC. I am runn...

ckeditor problem on Windows system

hi, i'v got a trouble, i want to use Ckeditor with my project, i have Windows with Zend Server installed (apache2, php 5.2, mysql5), encoding is utf-8. When i initialize ckeditor or another elRTE editor i have error: syntax error [Break on this error] \n all html is valid, if i delete doctype line, script says that error in another line...

Javascript new object (function ) vs inline invocation

Is there any considerations to determine which is better practice for creating an object with private members? var object = new function () { var private = "private variable"; return { method : function () { ..dosomething with private; } } } VS var object = function () { ... }(); Basically what ...

How do I make JavaScript to set these element values?

I have two fields that need to multiply each other and fill a 3rd form's value. Here's the HTML: <input type="text" name="estimate[concrete][price]" value="" onBlur="calc_concreteprice(document.forms.mainform);" /> per SF <strong>times</strong> <input type="text" name="estimate[concrete][sqft]" value="" onBlur="calc_concreteprice(...

Access asp:CheckBox inner input from jQuery

I have a jQuery array acting on each control having corresponding class: function Foobar() { $('.foo').each(function() { // do something with $(this) } } I can access client-side controls like <input class="foo"> and server-side controls like <asp:TextBox CassClass="foo"> But setting CssClass for asp:RadioButton doesn't ma...

Javascript code plagiarism checker

I was wondering if there was any tool available that detects code plagiarism and works well with Javascript. I want to test assignment submissions for homework I'm going to hand out. The only tool that I know of that can do this is MOSS, but, from what I've heard, it's pretty poor for anything else than C. Unfortunately, I can't test it...

Calling WebMethods / WebService using jquery is blocking

Hi, I'm generating a file on the server which takes some time. For this, I have a hidden iframe which I then set the .src attribute to an aspx file i.e iframe.src = "/downloadFile.aspx" While this is taking place, I'd like to have a call to a web service return the progress. To do this, I thought I could use window.setInterval or windo...

Pass information to php file from javascript while restricting user from doing it their self?

I am making a game where the battle system uses javascript to battle. At the end of the battle you either win or lose. If the user wins, I need to update the mysql database with the XP they earned. The best way I can think of doing this is to have the javascript run an ajax function when the user wins that POSTs something like addxp.p...