javascript

Error when running Rhino

I have downloaded and compiled the newest version of Rhino by going ant compile ant jar When I run it like so I get the following error java -jar js.jar Rhino 1.7 release 2 2009 05 12 Exception in thread "main" java.lang.NullPointerException at org.mozilla.javascript.Kit.classOrNull(Kit.java:92) at org.mozilla...

Jquery: Matching indexes of two arrays, string and object to replace text in object?

I have two arrays, one is full of strings, the other is an array of objects. The indexes on each correspond, and I want to replace the text of each of the objects in my object array with the corresponding text in my string array. For example, I have an array like this: var textarr = ["value1", "value2", "value3"] and a Jquery object ...

dojo.require() prevents Firefox from rendering the page

Im experiencing strange behavior with Firefox and Dojo. I have a html page with these lines in the <head> section: ... <script type="text/javascript" src="dojo.js" djconfig="parseOnLoad: true, locale: 'de'"></script> <script type="text/javascript"> dojo.require("dojo.number"); </script> ... Sometimes the page loads normally. But s...

Is there anyway to unit test javascript functions defined within a function?

Hi all: I would just like to ask whether I would be able to unit test the code inside ExternalFunction within the document.ready? I have tried many things for a while now and still couldn't work out how, and am at my wits end. $(document).ready(function () { var originalExternalFunction = ExternalFunction; ExternalFunction = f...

allow websites to prompt for information using scripted windows

I think I've used FF so long now and NOT IE that I've become dumb to IE 7 and 8. So this is a very late question and I'm sure everyone knows by now but "allow websites to prompt for information using scripted windows"...did this replace the allow javascript in the Advanced tab? Holy sh**, I can't believe it, but I haven't used IE in li...

Getting the value of a link by Javascript

Here is the situation: I have a link of a page that gives only 1 or 0; http://www.mybilet.com/connectors/functionAjax.php?islem=getBosDoluKoltuk&amp;serverId=228&amp;showtimeId=46666 Page is not mine. So I want to build an alarm system in another page according to this value. i.e. if the value is 1, the page plays a music. How can I ge...

Disabiling CKEditor, Re-enabling with JS

Hello, I have the following: POST page that allows users to write text in CKEditor VIEW Page, that views the text in CKEditor How can I make CKEditor in the view page READ only, meaning the user can not edit the text in the note? The reason I want to use CKEditor in the view page is for 2 reasons: 1. I can use JavaScript to move the ed...

Looping javascript get requests

I've got a javascript 101 question. I'm using a nice graphing library (flot), and plotting multiple graphs on a single page. Each graph is a div, with a attribute set that tells the graph where to grab it's data from. For example, the HTML might be: <div class="line-chart" data-src='/revenue.js'></div> <div class="scatter-chart" data...

jQuery plugin question - can I modify a core method?

I've developed a few jQuery plugins before which follow the format of either $('#something').myPlugin() or $.myPlugin(). I know you can also write your own selectors. What I was wondering if I could write a plugin that changes how the css() method works, that is, if I request a shorthand CSS attribute (such as padding) I could return s...

Client object for asp.net control

Hello guys. I'm trying to find out how to get properties and client methods of my controls be accessible via client scripts. For example, here is a very simple sample control: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyCustomControl.ascx.cs" Inherits="MyCustomControl" %> <script type="text/javascript"> $(function(...

live for jquery elastic plugin?

i use jquery elastic plugin for expanding a textbox. it works great but i want to use this on a textbox that is added to the DOM with ajax but unfortunately this plugin has no live built-in function. is there a way to solve this? http://www.unwrongest.com/projects/elastic/ ...

jQuery Uploadify

I have a simple question related to the jquery Uploadify plugin because I am not sure I understand the documentation. Please look here http://www.uploadify.com/documentation/ at the onComplete event. It says there are arguments sent to that function including the response argument. How can I access those arguments? If I do alert(respon...

Very basic HTML/scripting/active page question

Hi, A friend has asked me for help with her website design. Although I know a fair amount about the basics behind HTML, XML, Php, ASP.Net, javascript, etc., I'm not really comfortable sitting down and coding from scratch. All of the work I do is in Java, C++, and so on. My friend would like to add a vertically scrolling marquee to her ...

Javascript: how to append more text to user copied text ala nydailynews.com

On nydailynews.com when you copy and paste any text from the site, a snippet of text is appended. Read more: http://www.nydailynews.com/#ixzz0aN123abc How do they achieve this? I have searched all of the external JavaScript files (jquery) and can't seem to find anything that corresponds. Is this something that could be done in ...

javascript manipulate json object

For example, I have the following JSON object json_obj1 json_obj1 = {x:{id:1,bars:{show:true,barWidth:0.4}}} Now, how could I add the following object (using javascript): y:{id:2,bars:{show:true,barWidth:0.4}} to json_obj1 so that it will be: {x:{id:1,bars:{show:true,barWidth:0.4}},y:{id:2,bars:{show:true,barWidth:0.4}}} ...

convert digital display format

quick question, I have some integrate variable in javascript, say: 123456, or 123456789, it can be any valid number. Now, I would like to convert the number to a string like "123,456" or "123,456,789". Does anyone have a good algorithm for this? Of course, it should work for any numbers. For example: for 2000 ---> 2,000; 123456--->123,45...

IE 6 performance vs. clean, unobtrusive Javascript

Normally I love to keep my HTML code clean, semantic and free from either Javascript or CSS. I include my .JS and .CSS files at the top, and layer functionality on top of the DOM elements. The positives of this are: Architectural separation of concerns Graceful degradation where Javascript or CSS isn't supported Search-engine friendli...

What is the purpose of this JavaScript?

I was playing around with a Python-based HTML parser and parsed Stackoverflow. The parser puked on a line with HTMLParser.HTMLParseError: bad end tag: "</'+'scr'+'ipt>", at line 649, column 29 The error points to the following lines of javascript in the site's source: <script type="text/javascript"> document.write('<s'+'cript la...

Fixing JS errors in IE

I'm using jQuery for my app and I'm getting this error in IE: Line: 13 Char: 9 Error: Expected Identifier, string or number Code: 0 ..well, as you can see, the error isn't quite helpful. How do you fix those weird IE errors? Is there any tool or a list of error descriptions that tells you what to fix? Thanks ...

How might I replace a portion of a link's href attribute with a variable value?

I have the following code, written using jQuery: var strval = '22' $("#quicknote").attr("href", "javascript:location.href=/'http://site.com/notes/add?projects=/'+ strval") Which results in the following attribute: <a href="javascript:location.href='http://site.com/notes/add?projects='+'strval'" id="quicknote"> But, what I wan...