javascript

Is there a Calculus library for JavaScript?

Does anyone know of a Calculus library for JavaScript? I've done some Googling and haven't come up with anything. I applied for the WolframAlpha API, but that's expensive unless they choose to give me a grant. Ideally, I could feed an Array of 2d points into a function, and get back the graph (Array) of points of the derivative. If s...

trouble with loading a page in jquery via ajax

I am loading a page into a div via the jquery load function. The actual loading part is fine. The code looks basically like this: $("div#loadhere").load("newfile.html?" + new Date().getTime()); In newfile.html I have a series of divs, and I have code that (for testing) sends an alert when a div is clicked. That's fine too. The proble...

Modify the Google 'Add Bookmark' bookmarklet to store bookmark without popup?

The bookmarklet has the following code: javascript:(function(){var%20a=window,b=document,c=encodeURIComponent,d=a.open("http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=420px,w...

What is the best way to check whether javascript is enabled in client browser?

I am developing an application that uses javascript to perform some arithmetical calculations in forms. I would like to check if javascript is enabled in user's browser. If it is disabled redirect the user to warning page asking to enable javascript. I am aware of <noscript> tag. It is not enough just to display the message for me. I do ...

Maybe I've lost the plot, but why is this small piece of JavaScript not working?

I want a generic error handler for my forms var errorsBox = function() { var $errorBox = $('#form-error'); return { add: function(errors) { if ($errorBox.length === 0) { $errorBox = $('<div id="form-error"><ul></ul></div>').appendTo('form'); }; $errorBox.find('ul > li...

Can't seem to get shadowbox to work.

Hi guys, Ive ran into a problem getting anything with shadowbox to work. Here is the top of the page: <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Beginning Android</title> <link rel="stylesheet" type="text/css" href="shadowbox.css"> <script type="text/javascript" src="shadowbox.js"></script> <scri...

How to convert any .htc file into .js file?

How can I convert any .htc file into .js and use the resulting JavaScript? For example, this is a .htc file: http://curved-corner.googlecode.com/files/border-radius.htc. I want to convert it into .js. I want to convert it because the CMS I'm working with will not allow me to attach the .htc file. I think it's because of a mime type i...

What is the difference between "All browser compatibility" and "Cross browser compatibility"?

What is the difference between "All browser compatible" and "Cross browser compatible"? What is the means "Cross" is it means different OS? Can we say for any site that it is cross browser compatible, if it's working fine on Desktop version of IE 7, 8 FF 3+ , Safari 3+? or cross browser means all latest and Ancient browser on all OS a...

How can I detect when source of iframe is changed?

I want to detect when user clicks a link in iframe and changes the source of iframe, because I want to resize it. Also I use jQuery. What is the best way to detect this? Actually I need something like this (this example is in jQuery, it does not work, I imagined this) $('#iframe').live('load', function(){ alert('src is changed')}); ...

JavaScript displaying a float to 2 decimal places

I wanted to display a number with 2 decimal places. I thought I could use toPrecision(2) in JavaScript . However, if the number is 0.05, I get 0.0500. I'd rather it stay the same. What is the best way to do this? I can think of coding a few solutions, but I'd imagine (I hope) something like this is built in? Thanks Update See it o...

Creating a bookmarklet that doesn't get blocked

Goal: To create a bookmarklet that calls a remote javascript file that opens a popup window. The popup window is functionally similar to what Delicious's bookmarklet does. Background: Currently, I'm using window.open within this javascript file, however the popup is getting blocked by pretty much every major browser. The alternative s...

In IE Javascript execution speed is slower than Firefox, Safari and Chrome....

In IE Java-script load slower than Firefox, Safari and Chrome? Is there a way to load JavaScript quickly in IE also? General best practice is to keep JavaScript at bottom of the page, does it make Js rendering more slow in IE? Edit: When we apply any jquery plugin to website to make any usable or interactivity then in IE effect shows...

Facebook LIKE button hiding when page is already LIKED by user

hey there, I'm trying to create a page on my site where the Like button should be hidden if the user already likes the page. If I can't hide it, then maybe there's a way to get a callback when the like button is rendered with a user who already likes the page. This way I can hide/reveal the iframe myself. Any clues? Howie ...

Need help with a JavaScript function to determine ascending numbers

I have table rows, which have a start number and an end number (input fields). Per row, the end must be larger than the start. From inputs left to right, top to bottom the numbers must be larger than the last. So there are 2 inputs per row, and 4 (for example) rows. Each number is bigger than the last. I've been trying to validate th...

setAttribute doesn't work in IE6

how to set element attribute with javascript in IE6..? It seems setAttribute doesn't work. I really need to do it on the fly. Thanks. Code <script type="text/javascript" language="javascript"> menuItems = document.getElementById("menu").childNodes; for (i = 0; i < menuItems.length; i++) { if (menuItems[i].classNa...

How to find input tag od div 1 ?

Hi if we have div like this <div id="1"> <input type="text" /> <div id="2"></div> </div> <div id="3"> <div id="4"> <input type="text" /> </div> </div> now if i want to jump from div of id=4 to input tag of <div id="1"> using parent child relationship how can i jump to that particular input tag. Please help Th...

javascript string.lastIndexOf does not work with span innerHTML

Hello everyone, look the below example. <html> <body> <form> <span id="spTest">Your current operation: Modify &raquo; newone</span> </form> <script type="text/javascript"> var sp = document.getElementById("spTest"); var str = sp.innerHTML; //var str = "Your current operation: Modify &raquo; newone"; alert(str) var index = str.lastIndex...

Javascript AND operator with assignment

Hi there, I know that in Javascript you can do: var oneOrTheOther = someOtherVar || "these are not the droids you are looking for...move along"; where the variable oneOrTheOther will take on the value of the first expression if it is not null, undefined, or false. In which case it gets assigned to the value of the second statement. ...

javascript and seo

I have a javascript snippet that clients can put on their webpages that loads some text associated with embedded flash objects (like Slideshare presentations) on that page. Does Google crawl this type of content? Will this provide any SEO benefit? If not, what else should I consider. I don't want to force people to embed the actual con...

How to add the functionality in video ?

Hi suppoose we i have video in object tag not with javascript functionality i want to play pause stop forward backward that video ... suppose my object tag is. what could be functionality in javascript so that that video should play pause stop forward backward.. Please help Thanks... ...