javascript

Any way to stop Javascript from failing silently?

One thing that is driving me nuts is how Javascript fails silently in many different situations. (removed example because it confuses the point of my question) Many times I have come across an error that will give an error message when typed into the Firebug console, but when it runs within the page script, it fails silently, even with...

XML: Embedding a checkbox in a column of a listview

Hi folks, Here is my problem. I have some products name stored in the rows of my line view (retrieved from db). I would like to add a checkbox in a column so that the user could select some products he would like (and then update the db). Could someone please tell me how to do that in xml? Thank you. PS:Yes i am a newbie ...

JVM languages - Ruby Vs. Javascript

Hi all, What are the strengths/weaknesses of Javascript compared to Ruby when running them inside JVM? They'll be used by the users to write code which will be run in server. So, security and performance is very important. (I only need the comparison between JS and Ruby, and there are no direct comparisons anywhere. So please don'...

Set cookie domain with Javascript variable

Im taking the domain from the HTML of the page using jQuery: domainUrl = $("p.domain").text(); for the purposes of testing: <p class="domain">.vl3.co.uk</p> Which is also the domain Im testing the script on. This then give an alert containing the correct domain: alert(domainUrl); I want to the use that variable to set the domai...

javascript images array

hi, i'm trying to loop through all images on the page, should be easy but i can't see where im going wrong here. the imgs gets populated with the images but the imgs.length returns 0; its somethign stupid but i just cant figure it out. var imgs = document.getElementsByTagName('img'); console.log(imgs); console.log(imgs.length); if(imgs...

Is Function really an Object

I am a self taught web developer and am still trying to come to grips with some JavaScript fundamentals. Below are some quotes extracted from Douglas Crockford's Good Parts. "Functions in JavaScript are Objects" "In JavaScript, arrays are objects, functions are objects, regular expressions are objects, and, of course, objects are obj...

Debugging Javascript using IE Developer Tools

I've been using the above tool for some time now but recently I've had an issue when trying to debug javascript. I get the following message: Unable to attach to process. Another debugger might be attached to the process Visual studio seems to be debugging the javascript for me, which I don't want it to do. Any idea how I stop this? ...

Dropping Json object on html page in asp.net mvc2

Hi, i m using asp.net mvc2 and i want to drop some json objects from my controller similar to validation metadata. when we call Html.ClientValidation() before our form it drops some javascript on the page like <javascript type="text/javascript"> <!--CDATA[validation metadata]--> </javascript> i want to have some json objects dropp...

getElementByID().parentNode is returning null

For some reason, this is happening very vaguely. Its working sometimes and sometimes it is not. The same line of code, for the different "myid" under same parent, the line - document.getElementById("myid").parentNode is returning null. I am quite sure that element "myid" is not a root element and its parent is a DIV which needs to be r...

How to select a part of string?

How to select a part of string? My code (or example): <div>some text</div> $(function(){ $('div').each(function(){ $(this).text($(this).html().replace(/text/, '<span style="color: none">$1<\/span>')); }); }); I tried this method, but in this case is selected all context too: $(function(){ $('div:contains("text...

Custom Tile Layer Problem

Hi,I'm currently implementing logic on custom tile layers via OpenLayers function getTiles() { var res = this.map.getResolution(); var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w)); var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h)); var z = this.map.getZoom();...

jQuery and js file not loading?

I need to dynamically update the contents for every few seconds, without reloading the page, so i thought to use jquery load() function, this loads the contents fine but not the js or jquery file from head tag. Here is sample code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml...

Open a default mail client from a html page which has to pass data to "TO" field with more than 4000 characters

I can either use java or html to do this. I have tried using window.open(), but there is a cap on the length of string passed. I have tried using runtime.exec(), but with no luck. Can anyone suggest any other method for achieving this. I am not supposed to use java swing to achieve this. The java runtime I use is java 1.5.Please help me ...

Disable browser cache

I implemented a REST service and i'm using a web page as client. My page has some javascript functions that performs several times the same http get request to REST server and process the replies. My problem is that the browser caches the first reply and not actualy sends the following requests.. Is there some way to force the browser...

JavaScript: Building a HTML table from a nested JSON

I have a problem building a HTML table from the following JSON [ { "size" : 167, "price" : 453400, "type" : "Neubau", "children" : false }, { "size" : 167, "price" : 453400, "type" : "Neubau", "children" : false }, { "size" : 167, "price" : 453400, "type" : "Neubau", ...

Unexpected token default in Chrome with ({}).default

I receive error "SyntaxError: Unexpected token default" while getting or setting attribute "default" on any object in Chrome (+Opera). ({}).default Can someone explain why this happens ? upd: everybody, plz, becareful it doesn't make sense for FF so while testing you can miss this bug. ...

delete table row javascript

Hi, everyone, I have created new rows, but I cant delete it. When I click on the remove button, nothing happends. What am I doing wrong? Im greatfull for any advice. <table> <tr> somethingElse </tr> <tr> <td colspan="5"> <script type="text/javascript"> var inputCount = 0; function addRow(id) { ...

How to get the duration of days from today to a specified date in javascript?

Suppose the specified date is 2010-11-9, how to get the duration programatically? ...

jQuery datepicker setting date not working in IE8

The developer tools show no error message. Works fine on Chrome, Firefox and Safari. $("#datepicker").datepicker(); console.log($("#datepicker").datepicker("isDisabled")); // prints false $("#datepicker").datepicker("setDate", new Date()); console.log("here"); // doesn't print at all Thank you for any ideas. ...

rhino licensing problem

Hi I have not well understand how rhino license works. I would like make a commercial application (desktop) and embedding rhino to make available javascript to my users for easy customizing the application. according license there's seems there's no probs I only should print in copyright rhino notice.. http://www.mozilla.org/rhino/dow...