javascript

Dojo DataGrid, programmatic creation

I'm trying to create a DataGrid dynamically. Declarative creation is working fine: A source of data: <span dojoType="dojo.data.ItemFileReadStore" jsId="theStore" url="dataonly001.json"> </span> a simple layout: <script type="text/javascript" > var layout = [ { field: 'custId', name: 'Id', ...

Escape apostrophes inside double quoted strings (Javascript)

Say i have a string that i need to evaluate in javascript such as : window.some_class.update( 'Runner', 'update_runner', '{"runner":{"id":"1","name":"Nin's Lad" } }'); In order for eval() to evaluate it, i need to escape the apostrophe in runner_name (Nin's Lad). Is this possable with regex? I dont want to escape the single quotes aro...

Keeping the scroll to bottom

Hello, I have a shoutbox and I want to keep the scroll to bottom same as IM windows. My html is <div id="shoutContainer"> <table id="shoutbox"> <tbody> <!-- shouts here --> </tbody> </table> </div> My css #shoutContainer { height: 100px; overflow-...

how to inject javascript code in url to insert iframe in existing page

I am able to get the following JS to create IFRAME and add it to the page. The issue is if I create JS method on the page and ivoke it on a button click it works. But when I try to inject the same JS into the page url via setting the location.href it does not work the right way , rather it replaces the existing page with a new iframe. ...

javascript error "invalid XML attribute value <script language=JavaScript>\n"

i have some javascript files included in my html file for months. It used to work just fine until couple of days ago, now my scripts don't run anymore and i get javascript error "invalid XML attribute value <script language=JavaScript>\n" with firebug. Does anyone know what this error means and how to get rid of it? i guess is something...

Creating New Objects in JavaScript

I'm a relatively newbie to object oriented programming in JavaScript, and I'm unsure of the "best" way to define and use objects in JavaScript. I've seen the "canonical" way to define objects and instantiate a new instance, as shown below. function myObjectType(property1, propterty2) { this.property1 = property1, this.property2...

Javascript - why do I sometimes fail to read file content with GDownloadUrl?

Hi everybody. I try to read some file with google's GDownloadUrl and it works only from time to time. failure means fileRows == "blah blah" success means fileRows == (real file content) I've noticed, however, that when I cease (with Firebug) the execution on line 3 for a couple of seconds, it succeeds more often. Maybe it is some kin...

Trigger element's onclick method with JQuery [ASP.NET]

I have an ASP.NET server control that inherits from CheckBoxList that renders the controls with a UL and LIs. The control is set to AutoPostBack. Markup: <div id="foo"> <ul> <li> <input id="..." type="checkbox" name="ctl00$MainContent$FooList$0" ...

pasteHTML removes markup

I am writing a plugin to an old IE-only WYSIWYG-editor which resides in an old CMS. I've created a plugin that opens an popup where the user can enter the url of an youtube clip. The popup then creates the corrent <object..><param..> markup for the embed and uses Internet Explorers pasteHTML function; var range = plugin.editorDocument....

javascript error listener

hi all i try using window.attachEvent (or addEventListener) to capture js errors my callback function gets only one event parameter my question is: how do i get line number and source file of the error from this event? the alternative usage window.onerror=callback; works but an event listener has other benefits thus im giving it a try...

innerText/textContent vs. retrieving each text node

I've heard that using el.innerText||el.textContent can yield unreliable results, and that's why I've always insisted on using the following function in the past: function getText(node) { if (node.nodeType === 3) { return node.data; } var txt = ''; if (node = node.firstChild) do { txt += getText(node); ...

Trigger flash button object via javascript

Is it possible to trigger for example flash uploading button via javascript? For example I have made empty image wrappers and by clicking on them, they trigger flash button to open as select window. Thanks! ...

Selenium IDE - Passing a URL string variable into a conditional 'gotoIf' statement throws a Syntax error???

I am trying to store the current url (http://example.com)in a variable and compare it with another string as a condition in the gotoIf command (part of the gotoIf extension.js): storeLocation || url gotoIf || ${url}=="http://example.com" || label When I run this seleniun ide throws this error: [error] Unexpected Exception:...

Javascript appending onload to a popup window

I'm trying to append an onload event to a popup window in the following manner: var explorerWindow = window.open(PARAMS...); explorerWindow.onload = function() {window.opener.unlockObj(id);} The idea is to make the button that generates the popup window readonly, making it usable again once the popup window has loaded all of its conte...

Why doesn't javascript function aliasing work?

I have some Firebug console function calls that I wanted to disable when Firebug wasn't enabled, e.g. console isn't defined. This works fine in IE6 and FF3, but not in Chrome: var log; if(console){ log = console.log; }else{ log = function(){ return; } } I get an "Uncaught TypeError: Illegal Invocation" in Chrome =/ I read about ...

Silverlight 2 Video Player, passing a variable to the web page to manipulate via Javascript

I'm working on manipulating SL2 to be an audio player and has markers. However, when a marker is reached I'd like to manipulate the marker metadata via javascript. I see that he has allowed certain variables to be manipulated via javascript and I just want to add onto that. Any ideas? I have tried adding a scriptable member method in the...

Reliable way to get the "ancestor" of an object with a specific classname, using jQuery

I've got a javascript function that gets called on change event of a select form element. So, the "this" variable in js refers to the select element. This select element is in a td tag, in a tr tag. The tr tag has a classname of "FilterDetailsRow". Now, I've tested, and if I use this syntax: var filterRow = $(this).parent().parent()...

How to create own functions using jQuery and call it in another functions ?

I have piece of function which I am trying to call at two different places and so am thinking to put it inside a function and call that function at two different places. I am not sure how this can be done using jQuery: Any Sample examples would be appreciated ? ...

IE8 isn't resizing tbody or thead when a column is hidden in a table with table-layout:fixed

IE 8 is doing something very strange when I hide a column in a table with table-layout:fixed. The column is hidden, the table element stays the same width, but the tbody and thead elements are not resized to fill the remaining width. It works in IE7 mode (and FF, Chrome, etc. of course). Has anyone seen this before or know of a workaroun...

Navigate with location.href during XMLHttpRequest asynchronous call

I have a web page containing something like this: <div onclick="location.href = 'AnotherPage';"> This page also uses asynchronous XMLHttpRequests for some ajax updating. I have found that while an asynchronous XMLHttpRequest is in progress, clicking on this div does not load the new page. If I cancel my request first then it works fi...