javascript

Is there a way to update the dom without effecting the Mouse Cursor?

For example, I'm using the following function: $('body').html( function(i,html) { var arr = html.split(". "); arr[arr.length-1]="<span class='findme' >"+arr[arr.length-1]+"</span>&nbsp;"; alert(arr) return arr.join(". "); }); The problem is it moves the cursor away from where the user was typing. Has anyone else seen t...

Transform Javascript Array into delimited String

I have a Javascript string array with values like A12, B50, C105 etc. and I want to turn it into a pipe delimited string like this: A12|B50|C105... How could I do this? I'm using jQuery (in case that helps with some kind of builtin function). ...

Overriding window.alert and passing multiple parameters.

I am trying to override the window.alert to pass multiple parameters. Please someone explain me why for/in inherits Array.prototype.tester's body into list? Thank you very much. Array.prototype.tester = function() { return 'tester'; } window.alert = function() { var args = Array.prototype.slice.call(arguments); var list ...

Why aren't these two bits of JavaScript equivalent?

in jquery 1.4.2, ff 3.6.6: The following code produces three divs, which write messages to the firebug console as you would expect. However, if you uncomment out the loop and comment out the 3 lines doing it manually, it doesn't work - mousing over any of the divs results in "three" being written to the console. Why are these two me...

How to read compacted javascript?

There are many compacted javascript source code in web and I am wonder how to transfer it to the normal code and make it readable? Are there any exsited tools or scripts? ...

javascript if - else shortcut doesn't work?

I have a checkbox couple with values "new" or "existing" company. $("input[name=company]:checked").val() with jQuery shows me the value of the checked box. Now if I do: if ($("input[name=company]:checked").val() == "new") { is_new_company = true; } else { is_new_company = false; } alert(is_new_company); I get ...

IE6 won't acknowledge new styling implications of dynamically added content

I have most of my page's content within <div id="ret">. At some point, this content is wrapped inside a <div id="_"> -- this has all sorts of CSS implications, as there is a stylesheet that has already loaded with the page full of rules beginning with the selector #_ #ret{}. However, the new styling implications are not acknowledged (I'...

Update sum on table change (tr add, remove, focus, type...)

Hi, I'm looking for the best way to trigger (call) a function which will sum all the input fields in all table rows. The problem is, that the field can be manipulated manually (by typing) or with a function - value written to them (which does not trigger an event). I would like that the sum function would trigger on add/remove row (tr...

Exporting DIV area content in HTML using Java Script

Hi Guys, How can export DIV area content from an HTML Page to PDF?. Is it possible using without third-party tool, using JavaScript?. Please suggest ...

Dynamic evaluation of functions in JS (is this safe?)

I have a website in which all the pages are processed through an index.php that includes different PHP files depending on the requested URL (this is done through mod_rewrite). I'm using the following method to execute specific functions at page load: index.php <script type="text/javascript"> readyFns = Array(); </script> <?php // Do ...

Use the value of a string variable as the 'index' of an existing object in Javascript

I am using Javascript. I have var myobj = { "one": { "name" : "paul", "no" : "A123" }, "two": { "name" : "mike", "no" : "B456" }, "three": { "name"...

Update html container with Javascript - Strange issue

Hi All, I have a javascript function that is fired by a javascript timer. Every time the timer fires, I need to add an html string to a container that can accept & display html on the screen. As more html is appended to the container, the container scrolls to the bottom. My problem is that the html stops getting shown after a while i...

Cross site scripting forms

I want to help fill forms for my users with default values on other pages. To do that I would like to show another page (from different domain) in an iframe and insert there default values when needed into fields. But it is not possible because of cross site scripting protection. I have checked http://sourceforge.net/projects/poxy/ and ...

most efficient javascript method declaration

While writing javascript, one can define a method in 3 different ways. 1] A function in global namespace function doSomething(); 2] A function that is member of a function function Clazz() {} Clazz.doSomething = function(){}; 3] A function that is memeber of the instance of function function Clazz() {} Clazz.prototype.doSomething...

Get articles through RSS from Wordpress with JavaScript

Is there a way to get recent articles using JavaScript from Wordpress blog? I need to show some content from the blog easy way on a static page so I think JavaScript would be fine for this. ...

iPhone dev using Javascript to display map

Hi, I am using JavaScript to retain the current location and the map This is my code: <html> <head> </head> <body> <div> <script type="text/javascript"> navigator.geolocation.getCurrentPosition( function(position){ var latitude = position.coords.latitude; ...

Javascript Trojan Dissection

Hi all, I've recently been playing with allot of Javascript and started to consider that I couldn’t encounter a piece of Javascript that I wouldn’t be able to debug. Well I was pleasantly surprised and angered today when we discovered a number of javascript redirect trojans on our company’s website. Most of the code we found I was abl...

How to read the content from a (local) file with SpiderMonkey on the command line?

I want to use SpiderMonkey for driving a test harness (for the in-browser version see here). Now, I tried the following: var defaultFileName = "all.n3"; var reader = new FileReader(); reader.readAsText(defaultFileName); reader.onload = fileLoaded; which fails with the following error: regression-tests.js:9: ReferenceError: FileReader...

red free support for images

I am working on a web application for a opthology research firm. They work on cornea images and use red free light to identify lesions (artries and nerve fibers) easily. I have implemented the addAmbient() method provided by microsoft for this purpose and it is working fine. <img id="eyepic" src="GetImage.jsp" height="1291" width="1944" ...

Simulate a click with CURL (PHP)

Hi everybody, I'm using CURL to extract some real estate listings. But, recently, a website changed his way to communicate the phone number: The visitor must click on a "Show the phone number" link that returns the result in jSon. I found these information with Firebug: http://www.realestate.com/phone/click.json?Id=023DSFS And for th...