javascript

Listen to chaning text in a Span Element

I have a span element which display's a changing duration value. <span id="vtime">--:--</span> Unfortunately, due to the JS API i am using these is no way to pick up that value other than to listen to the changing text in the Span element. I want to pick up the values and execute a javascript ajax command to fetch a value for the ca...

How do I attach a jQuery event handler to a YouTube movie?

[EDIT: Sorry to those who already answered -- in my sleep-deprived state, I forgot that this particular situation is a YouTube movie, not the JW FLV player. I can see that there is more extensive documentation on interacting with YouTube movies, so I will pursue that, but any more information is also welcome] I am using embedded YouTube...

Where to put JavaScript configuration functions?

What is the general developer opinion on including javascript code on the file instead of including it on the script tag. So we all agree that jquery needs to be included with a script file, like below: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script> My question i...

disable text selection while pressing 'shift'

I'm implementing item selection functionality in javascript (using jQuery). item is a li that contains some html. the user can click on one item (makes it selected) and then shift-click on another item to select all the items in between. this basically works OK, however the shift-click also selects (higtlights) the text that appears insi...

"simple math syntax" to MathML converter

I'd like something that converts a simple calculator like ascii math syntax to mathML. I found this: http://www1.chapman.edu/~jipsen/mathml/asciimath.html But I don't understand how to use it.. I'd like to make it work from the command line for example, so that I feed it some math formula and get back the mathMl version. How could I do...

Generating random numbers in Javascript

How can I generate a random whole number between two specified variables in Javascript, e.g. x=4 and y=8 would output any of 4,5,6,7,8? ...

multiple select values error

I have a form that allows the user to select up to X amount of options from a multi-select field. If the user selects an item greater than the X items it prompts and de-selects the last selected item. There is an issue when the warning message has been thrown by a previous multi-select. The form have 4 mult-selects, so if its thro...

img not showing

I have the following javascript function to create an image that will show on hover of another image, but the image does not load... just the little symbol that goes in place when it cannot find an image. What is wrong with this code: function createimg() { var img = new Image(); img.src='images/imageoverlay.png'; img.id = '...

wrapAll jQuery problem

I need to wrap three divs into one, but that group of three divs is repeating itself several times in code. Maybe my HTML will explain: <div class="one" /> <div class="two" /> <div class="three" /> <div class="one" /> <div class="two" /> <div class="three" /> What I'm trying to achieve is this: <div class="wrap"> <div class="one" ...

Secure login: public key encryption in PHP and Javascript

I'm trying to make a "normal" username/password login form secure, without needing HTTPS. My idea is this: Server generates a keypair for some kind of assymetric encryption algorithm. It stores this keypair in a temporary table of sorts (or perhaps the local session data). Server sends the form to the client and includes the public key...

Is there a Javascript or Jquery script that emulates Stack Overflow's flash message (the orange bar on top)?

It's a neat looking script that I can't seem to find anywhere. Any idea on where you can find a script like it? ...

Javascript variable scope question

Hello! Consider the following piece of code: <html><head></head> <body> <script type="text/javascript"> var outside_scope = "outside scope"; function f1() { alert(outside_scope) ; } f1(); </script> </body> </html> The output for this code is that the alert box displays the message "...

IE7 rendering and javascript differences between 7.0.5730.13CO vs 7.0.5730.13

I have a site a client is trying to use that doesnt work on their machine using IE7 version 7.0.5730.13CO. We know it works on version 7.0.5730.13 with all. By 'work' I mean it renders different and the javascript functions differently. I found a site (basically the only site I could find on google about it) that said the CO was for Cor...

How to reference javascript files from another project?

Hi all: I'm currently trying to write some unit test on some javascript files. My first and foremost problem with that is that my test files are in a different project than the actual javascript files. I'm running VS2008, and in my test project, I have included a reference of the actual project file. Assuming I'm writing my tests in ...

Jquery fadein and fadeout script not working

This function should fadeIn the id="Box" when class="display" is clicked if the Box is not animated and has a display value of none Or fadeOut if the #Box had a display value of is not none. What is wrong? $(document).ready(function() { $('.display').click(function() { var currentDisplayValue = $('#Box').css('display'); i...

best way to handle read-/write-only properties in scriptable browser-plugin

Writing a embeddable cross-browser plugin that is scriptable via JavaScript i am unsure how to handle read-only and write-only properties the best way. Is it more common or intuitive to discard values silently on write for read-only and return dummy value for write-only or to indicate failure to the browser, most likely resulting ...

Can I execute a AJAX-enabled webservice method on the onbeforeunload event of a browser ?

Hi guys, I am trying to execute a webservice method call from the javascript on the page, just before the user leaves the page. I got the javascript speaking the webservice perfectly. However, when I try to hook the javascript function to the window.onbeforeunload event, nothing happens. <script type="text/javascript" language="javascr...

Handling optional parameters in javascript

I have a static javascript function that can take 1, 2 or 3 parameters: function getData(id, parameters, callback) //parameters (associative array) and callback (function) are optional I know I can always test if a given parameter is undefined, but how would I know if what was passed was the parameter or the callback? What's the best...

Implementing canplaythrough in SoundManager2

I need help making an algorithm to detect that all the conditions for HAVE_ENOUGH_DATA are met (and continuously checking until they are met) and I am stumped as to how to calculate all the necessary variables using SoundManager2's whileloading option. I don't need code, just a general algorithm that would work (even pseudo-code is fine)...

jquery autogrow

hi to all I know that combining two framework prototype and jquery is not a good idea. But I already a lot of code made by prototype, But when I discovered jquery I decided to use this because there is some methods and functions advances than prototype. My question is I was using jquery autogrow but it was not work if I am using protot...