javascript

How to find the variables defined in a function.

Suppose I have a long javascript function such as function test() { var x; var a; ... ... ... ... ... } is there any way I can ask the function itself to tell me what variables were defined so far. function test() { var x; var a; ... ... ... ... ... // bit of code that would say to ...

Session time out

<script language="javascript" type="text/javascript"> setTimeout('SessionTimeout()', <%= Session.Timeout * 60 * 1000 %>); function SessionTimeout() { alert(<%= "'Session time out!!'" %>); window.location = "Default.aspx" } </script> Does the above code will help in session time out ? If so how many minutes? ...

HTML annotations (selecting, highlighting, remove format)

I am working on a cross browser web based annotation toolset, which allows the users to select any part of a web page HIGHLIGHT, if you select: john is <li>big</li> <li>dump</li> Result <span style="background-color: rgb(106, 168, 79)">john is</span> <li><span style="background-color: rgb(106, 168, 79)">big</span></li> ...

Testing JavaScript functions inside anonymous functions

Is it possible to test myInnerFunction below? var val = function() { var myInnerfunction = function(input) { return input + ' I ADDED THIS'; }; return myInnerfunction('test value'); }(); Because myInnerFunction is essentially a private member of the anonymously executed outer function, it doesn't seem like it is te...

make select box values faded out/unclickable

Hi, I have a normal HTML select dropdown box <select id="day" name="day"> <option value="0">All</option> <option value="1">Mon</option> <option value="2">Tue</option> <option value="3">Wed</option> <option value="4">Thu</option> <option value="5">Fri</option> </select> But on occassion I want to make some options not clickable,...

Drawing a grid in javascript ( game of life, for example )

Essentially, I had this idea in my head for a sort of evolution simulator, not exactly like Conways Game of Life, but the one part where they do match is that they will both be based on a square grid. Now, personally, I like working in HTML+Javascript+ for simple apps, since it allows fast UI creation, and if you're not doing something ...

Auto load a specific link at various time intervals

Here's what I need to do. I'm using Google Chrome. I have page that auto-reloads every 5 seconds using a script: javascript: timeout=prompt("Set timeout [s]"); current=location.href; if(timeout>0) setTimeout('reload()',1000*timeout); else location.replace(current); function reload() { setTimeout('reload()',1000*timeo...

Split String at specific character

I have the following code: var string = "word1;word2;word3,word4,word5,word6.word7"; function ends_with(string, character) { var regexp = new RegExp('\\w+' + character, 'g'); var matches = string.match(regexp); var replacer = new RegExp(character + '$'); return matches.map(function(ee) { return ee.replace(replacer, ''); }...

Disabling a link tag using JavaScript on my printable page

I have a script that creates a printable page by copying the HTML across and then doing some manipulation, such as disabling the buttons on the page, on page load. I also want to disable the links on the page. I don't really mind if they look like links still as long as they don't do anything, and don't give any JavaScript errors! The a...

How can I edit a JavaScript variable?

Hi, Say I have a variable tab_something I need to drop the tab_ bit. In php it's easy, using str_replace... Will tabSelect = document.location.hash.substr(1,document.location.hash.length); (which would always be tab_something) document.write(tabSelect.replace(/tab_/i, "")); Work the way I would like it to, consistently acros...

Writing Content Between Firefox Tabs

I am trying to write some values that I extract from a page (via JS/JQuery) opened in a tab in Firefox, to another opened page in a different tab within Firefox. Is this possible? Basically, I am trying to write some values I extract to a Google document that I have open in a different tab. I can see the "document" value in the DOM fo...

How to convert Javascript to C#

I have got some javascript code and I'd like to convert this to C#. I have no idea of the best way to structure this or if there is an easy way to convert the code. A sample of this code is shown below. // ellipse parameters var e = { WGS84: { a: 6378137, b: 6356752.3142, f: 1/298.257223563 }, Airy1830: { a: 6377563.39...

Hidden field value in update panel not updated when accessed from JavaScript

I have a hidden field inside an update panel (.Net 3.5). On an asynchronous postback I update the hidden field value from code-behind, but when I inspect the value from JavaScript the hidden field has the old value. On a new postback, the hidden field value in code-behind is correct, updated from the previous postback. How can I get the ...

Javascript Certification

Is there any proper Certification for Javascript, that covers all the advanced topics of Javascript including the DOM (Document Object Model), BOM (Browser Object Model) and CSS Object Model, that can really evaluate the skills? I've no idea how to scale myself on my JS skills, so any suggestions would be beneficial. ...

CKEditor throws exception: 'n' is null or not an object

I have traced the root of this exception to the sourcearea plugin of CKEditor v3.0.1. It occurs (occasionally) after the user has entered content into the editor and he then clicks on the small arrow in the upper right hand of the editor (close toolbar arrow). Has anyone seen this problem? We are using IE6. onResize(){ textarea.hi...

Call function with multiple arguments

Can I call a function with multiple arguments in a convenient way in JavaScript? example: var fn = function() { console.log(arguments); } var args = [1,2,3]; fn(args); I need arguments to be [1,2,3] just like my Array. ...

Is data.success javascript, jquery or json?

I googled data.success, but I could not proper document. What is data.success in the following jquery? Is it javascript, jquery or json? function remove_row(data){ if(!data.success) return alert(data.error); $('#delete_link_'+data.id) .closest('li') .slideUp('slow',function(){ $(this).remove(); }); --E...

handling forms and textbox for multiple button

As you can see here that I have a text box with three submit buttons each redirecting to a different jsp page, however in those jsp pages, when I do request.getParameter("bid"), all I get is null... How can I fix this the simplest way possible? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm...

Is it possible to hit a breakpoint set in a javascript file with visual studio while using Firefox?

I tried setting a breakpoint in visual studio in a JavaScript file and i get a message when i hover on the breakpoint, which is: "The breakpoint will not currently be hit. The document is not loaded." I am using firefox. Is it possible to hit the breakpoint and how? ...

How do I detect support for contentEditable via JavaScript?

I've been searching for this for a couple of days now and so far, the best I can come up with is checking the list below. I really don't like to check for support based on User-Agent, especially since it can be spoofed. I've also heard of at least one instance where the list below is incorrect (noted below). Is Internet Explorer? Is ...