javascript

How do I restrict a string to a specific set of characters in JavaScript?

To put this in context, consider these 2 functions: ml_RestrictToChars = function(input,regex) { var result = '';var c = ''; var rx = new RegExp(regex); for (var i = 0; i < input.length; i++) { c = input.charAt(i); if (rx.test(c)) { result += c; } } return result; }; ml_OmitChars =...

Tinymce setcontent a link an selected img

Hi! In Tinymce I select an image. I would like to create a link with this: var code = window.opener.tinyMCE.activeEditor.selection.getContent(); window.opener.tinyMCE.activeEditor.selection.setContent(code); but not work. If i select a text then work correctly! Please help me i dont understand that why??? ...

timezone countdown

Right now I am using this Javascript timezone timer: http://www.hashemian.com/tools/javascript-countdown.htm This works but it will calculate from YOUR computer time. I don't want that. I want a timer that counts down from the timezone I am in (USA EASTERN) so instead of the page loading at THEIR time.. it would finialize the countdown ...

What new(er) technologies does Google Instant Search use?

Is Google Instant search using Google Wave DOM diffs or something?(or maybe they are using Etherpad based tech) for speed? does it reuse/create elements with xpath? whats the speedup? what else that's interesting is going on? ...

jQuery dynamic form submission

I can easily find how to submit an existing form using jQuery. But how can I, given a URL, and some parameters create and submit this form on the fly? ...

Flex tree view with wrapped text on nodes

Guys, I've spend hours searching for a way to put one paragraph of text in one tree node in Adobe flex. How can I do it? I created a simple tree view but the text is cut after the right border. So I tried to create a tree renderer. In the renderer I specified width=100 and the text wrapped. But the height of the nodes was not being cal...

On focus JavaScript Error

I have a dojo dropdown list widget here is the code: dojo.forEach( dojo.query(".select-frame-inner-border ",_this._container), function(obj){ evt = dojo.connect(obj,"onmouseenter",function(){ if (_this._disabled){return;} _this.hasManualFocus = true; **_this.ob...

How to make a Jquery Popup note

Hello, How would you make a JQuery popup Note ? This is what I currently have, Note Code Example <html> <head> <script type="text/javascript" src="jquery.js"> </script> <style type="text/css" rel="stylesheet"> #popup { border: 1px solid black; widt...

REGEX: Capture Filename from URL without file extention

So I am trying to create a Javascript Regex that captures the filename without the file extension. I have read the other posts here and 'goto this page: http://gunblad3.blogspot.com/2008/05/uri-url-parsing.html' seems to be the default answer. This doesn't seem to do the job for me. So here is how I'm trying to get the regex to work: ...

cross browser hide mouse cursor

I would like to enhance a depth effect by hiding the mouse cursor as it passes over a div, is there a method that will work across all browsers? ...

dynamic web page automatic snapshot

Hi!! I have a dynamic web site (php/mySQL/Ajax on a Linux server), I need to take automatically a photo (snapshot) of each web page periodically (If I can find the way to do the snapshot... I can use cron) and save this image to the database (I also know how to do this...my only problem is the photo!). I can't do it manually, so I need...

object[index] - Javascript Object Error in IE - Object doesn't support this property or method

I have a simple script to retrieve an id from an object list in javascript. Here is the example: var element_id; if (cur_index !== 0) { element_id = _BIG_LIST[cur_index-1]; } IE is throwing an error at: _BIG_LIST[cur_index-1] Error is Object doesn't support this property or method. This works fine in other br...

Suggest a better way to make online coding contest website

Hello i want to develop a online coding contest website on which a user select a programming language(c,c++,java) then writes it's code and then click on compile and it's code get compiled and the output will be shown(with errors if any)? so my question is that: is there any existing framework or a already developed solution from...

Is there a "special" URL param to force SWFObject to show alt content?

I remember doing this years ago, but can't remember if it was with SWFObject. Anyone herd of this before? I guess it would basicly disable SWFObject from switching the altContent for the SWF. I though it was something like: www.mysite.com?noflash=true But can't remember the real one (if it exists). Thanks ...

How to restructure an AJAX search form

I have this page (A) that has an input field and once you submit it, it makes an AJAX call and displays the results. Now, I need a search field on another page (B) that once you submit it, it redirects you to the former page (A) with the results displayed as if you did it on the first page (A). What would be the best way to handle this?...

how to know following page

Is there's a way to know, in javascript, if the page will change ? During an event (ie a click) is there a way to know what is the coming page without checking element's href (if clicking on a link) or form's action (if submitting a form) ? ...

does this count as metaprogramming?

I am going to write a groovy script to generate a buttload of constants in a javascript file. ;) Maybe cross-language metaprogramming? meta-language meta-programming? To be clear, I am asking what category this falls under ...

Dynamically printing javascript

I recently ran into a situation where it made sense (at first at least) to have my server-side code not only "print" html, but also some of the javascript on the page (basically making the dynamic browser code dynamic itself). I'm just wondering if there is sometimes a valid need for this or if this can usually be avoided...basically fr...

Injecting JS in Google Chrome's page with variables from the userscript?

Hello, I am having a script that used unsafeWindow in FireFox, since that did not work, I have searched for another option, and found it, I am only wondering: How can I use a variable from my userscript into the unsafeWindow workaround? My code is: // ==UserScript== // @name Test // @description Test // @include http://www.google*...

JavaScript scoping w/ closure: help me understand

Running the following code: for (var i=0; i<3; i++) { setTimeout( function() { console.log(i); } , 500 ); } Outputs "3" three times. It's outputting the final value of i as opposed to the value of i when the inner function is created. If I want the output to be 1, 2, and 3, how would I write this code? How can I get it to use th...