javascript

ResetIsDirty on FCKeditor immediately after SetHTML -- Concurrency/timing issue with Javascript

I am using IsDirty to check for changes in my FCKeditor. Unfortunately, it seems that its functions are asynchronous. Here is the failing code: var txtObj = $('activities').EstActText1.id; var oEditor = FCKeditorAPI.GetInstance(txtObj); oEditor.SetHTML(jsonObj.DATA.ESTACTTEXT1.toString()); oEditor.ResetIsDirty(); The problem is, Set...

Spell Checker for my asp.net mvc application

hello Friends, Can any one provide me a good tutorial about to implement spell checker? that is I have a textarea and one button.. what ever I enterd in to the textarea i need to do the spellchecking on that.. thanks Thanks ...

How to replace "i" in <li>anything</li> using regex

How to replace "i" in <li>anything</li> using regex Code : var code = "<li>anything</li>"; // i don't know what is in <li>......</li> result should be : var code = "<li>anyth1ng</li>"; // i don't know what is in <li>......</li> ...

How to create DOM object from html page received over XMLHttpRequest?

I'm developing a chromium extension so I have cross-host permissions for XMLHttpRequests for the domains I'm asking permissions for. I have used XMLHttpRequest and got an HTML webpage (txt/html). I want to use XPath (document.evaluate) to extract relevant bits from it. Unfortunatly I'm failing to construct a DOM object from the returned...

JQuery: How to unbind a specific event handler

Code: $('#Inputfield').keyup(function(e) { if(e.which == 13) { functionXyz(); } else { functionZyx(); } }); $(document).keyup(function(exit) { if (exit.keyCode == 27) { functionZzy(); } }); Question:...

CKEditor: Access CKEditor from Custom File Browser even after browsing to a new page in popup

Hi all, I'm creating a custom file browser for CKEditor. In the popup window that CKEditor launches, the user can select a file... at which time the following code is run: window.opener.CKEDITOR.tools.callFunction( funcNum, url ); This works great when the user stays on the same page that was originally launched by the CKEditor. The ...

Attempts to reset javascript form make form disappear.

I created a form that randomly selects 12 T/F questions from an array of 16, displays them in a random order and will score it all at the end. The problem is that I cannot get the form to clear on refresh. When I try with nearly any method, the form, questions and all disappears. The reset button, however, does work. Here's the form: ...

PHP - form checkbox submit with ajax

Hi, I hava set up AJAX script that when you click the button it calls a PHP document. The problem I have is now some of the variables of the PHP file are set to constant, and now I want them to be conditional to what gets sent when the button is clicked. I want there to be a check box, that if clicked, will set a PHP variable to be TR...

Is something wrong in this Spell checking using jquery

<script type="text/javascript"> // check the spelling on a textarea $("#check-textarea").click(function (e) { e.preventDefault(); $(".loading").show(); $("#text-content") .spellChecker({ lang: "en", engine: "google", suggestBox...

Get Navigating event when JS opens a new browser window using WebBrowser control

I'm using C# / .NET 4. I have a form with a WebBrowser component on it. I have loaded an external web page to the WebBrowser component. I have an event handler attached to the Navigating event. This works for most things. however, one part of the web site I'm loading executes a window.open(url) javascript command. This has the effect o...

conditionally load javascript (external and internal) and keep execution order

I'm looking for a way to conditionally load and keep the execution order of some javascript files (external and internal) without any library dependency. Basically, what I want to do is load them up only if the browser supports localStorage. Here's basically my shell: if (window.localStorage) { //load up JS only if it's needed var...

Javascript ouside public_html?

Is there any way/reason to keep your js/jQuery ouside public_html? Are there security benefits? ...

prevent user to type non-english characters

Hi, I am using this one to prevent user to type special chars. String.prototype.isText = function () {return /^[\w\s]*$/.test(this)} How can i change it to prevent users to type non-english words ? (only apostrophe and & will be accepted as special char) thanks so much ...

Javascript: Object's this.var inside jQuery method

Hi, I can't figure this one out: I have a function, e.g. function test () { this.rating = 0; $j('#star_rating a').click(function() { alert(this.rating); }); } var foo = new test(); On click it alerts "undefined". What is wrong? Please help. ...

No need to define a variable twice

If a variable could be defined in a function, even if no value is assigned, it becomes a local variable so, is testB() better programming? var test = 'SNAP!' function testA(boolean) { if (boolean) var test = 'OK'; else var test = null; alert(test); } function testB(boolean) { if (boolean) var test = 'OK'; alert(test...

Load Recaptcha script with Prototype

I need to load the Recaptcha library on demand, with javascript (using Prototype): var captcha = new Element('script', { type: 'text/javascript', src: 'http://api.recaptcha.net/js/recaptcha_ajax.js' }); $$('head')[0].appendChild(captcha); captcha.onload = function() { Recaptcha.create("dsfahsldkjfhlasdjfc","recaptcha_image", {theme: "...

Google Maps API v3 panorama problem

Hi-- I'm updating some v2 API code to work with the v3 API. For the most part it's way better. But I'm running into some issues with the panorama object. Though the panorama object appears in the correct div, and all the copyright/controls appear, the window is blank (solid grey). Oddly the pano window shows the proper address for the g...

Mod or 33% function regarding jQuery Progressbar update to 100%

How might one handle making a progressbar update to 100% based on having one or more items from all 3 groups? For instance if I have 20 fruits, 0 grains, and 2 vegetables, it should show 66/67%. If I have 1 or more items from each group, show 100%; and having only 1 or more of 1 group should show 33/34% complete. I'm not sure if I sho...

Grab And Format XML Data From PHP File As JSON

Hi, I'm writing an app currently that uses the ExtJS framework. I'm pulling an XML feed from an external site using cURL, loading as simplexml, json_encode-ing it, and writing it to a file a .JSON file which I will later access with ExtJS data store. However, the formatting is becoming funky because the XML generated from the PHP fi...

How to optimize CLASS function in jquery

I'm profiling JavaScript using dynaTrace AJAX edition. According to the tool's "Hot Spots", the following jQuery method is using the majority of execution time: CLASS(*, *, undefined, *, undefined, false): false ...it has over 700 invocations on my page. What is this call and how can I optimize it? I'm using jQuery version 1.4.2. T...