javascript

Detecting end of Flash movie in javascript

Is there a way to detect end of Flash movie (OOTB, without using some sort of flash callback). Alternatively, is there a way to know the length of the movie? Update: IsPlaying() looked promising (periodically checking it), but as it turns out, nobody is creating straight forward swfs any more; now, the content is embedded in main lay...

jQuery: select element from parsed html snippet

Inside a class method I parse a html snippet like this: this.editCtrl = $('<input type="radio" name="society" value="existing"><select class="society"></select></input><input type="radio" name="society" value="existing"><input type="text"></input></input>'); I can add this snippet to my DOM and everything works fine, but before do...

Is it possible to take a crawled html file, and get information about how a browser would render it?

Examples of stuff I'd like to do: - process javascript and produce new DOM - be able to provide information about DOM objects as rendered (e.g. position, size) Edit: My main concern is if a page contains a large, central flash object (typically a movie or game). ...

(javascript) how to i get the ID of an element i've selected?

let's say I selected a bunch of elements by class. how do i find out what the ID is of each of my returned elements? ...

Javascript: how to override public method in some class?

I have such JS class: SomeClass = function { // some stuff that uses initRequest this.initRequest = function() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } } ...

disable all click events on page (javascript)

Whats the easiest way to temporarily disable all mouse click/drag etc events through javascript? I thought I could do document.onclick = function() { return false; }; ...etc, but that's not working. Thanks ...

How to apply css property using javascript?

I have the following structure of the code, if the height of UL exceed 270px, then i want to add the css property overflow-y:scroll; or else as it is. <ul class="tabs"> <li>Content</li> <li>Content</li> <li>Content</li> </ul> ...

New to jQuery, simple popup window script, any problems?

Still a little "gunshy" about jQuery. Does this simple popup window script look okay? Is my jQuery logic right? I have a few questions in the code comments that I'm curious about. $( document ).ready( function() { $( "a[target='popup']" ).click( function( event ) { var $href = $( this ).attr( 'href' ); // should I use "thi...

Base 64 encoding, Java or JavaScript?

Hi guys, i've a particular js function that encrypts some form inputs into base64, but I need to run it in my Java app. So my question is, how can i call that function inside a java class? Otherwise I'll have to translate it but I think will be more complicated. Here's some of js code: function encode64(input) { //alert(input); ...

How to reset a field when changing a date ui.datepicker.js [Solved]

Hi, I'm using ui.datepicker.js I have a form and when the date is changed I want that another field reset the status (this field is a dropdown select box). The case is the following: The user enter the latest billing date in the calendar (when he prepare a bill) and he select the status unpaid, when he will received the money he will...

How to make when we tick on checkbox and another input will fill up automatically

Form by example. $fullname = 'John Travolta'; <input type="text" name="fullname" /> <input name="same" type="checkbox" /> Tick if same name When we tick on the checkbox the input fullname will insert automatically by data from $fullname How to do that by javascript, jquery or etc ? ...

Prevent onclick action with jQuery

there are some links with onclick event actions <a href="#" onclick="alert('panic!')">Let's panic</a> <a href="#" onclick="alert('panic!')" disabled="disabled">I can't panic no more</a> I need prevent event actons execution on links with disabled attribute without removing onclick actions. $('a[disabled]').click(function(e){ e.sto...

depress same origin policy

Hi. I have a 'toolbar' that displays some code on the top of the window, and then I load an iframe with an external site. I realize that I can't get the active link the user is on because it would be a violation of same origin policy. Is there any way (using greasemonkey maybe?) that I could get the active url of the external iframe? ...

Regular Expression to find URLs in block of Text (Javascript)

I need a Javascript regular expression that scans a block of plain text and returns the text with the URLs as links. This is what i have: findLinks: function(s) { var hlink = /\s(ht|f)tp:\/\/([^ \,\;\:\!\)\(\"\'\\f\n\r\t\v])+/g; return (s.replace(hlink, function($0, $1, $2) { s = $0.substring(1, $0.le...

form.js error in MOSS 2007

All of a sudden our development sharepoint publishing stopped working. I am not able to add any new items to Lists. Following are screenshots in different browser when trying to add a new item. Internet Explorer 7 : JavaScript error occurs soon after I hover over the rich text editor. There are no required fields but still editor says I...

Focus input field with JQuery without selecting current value text

$("#myinputfield").focus(); Doing that on an input field with it's value already set causes the current value to be selected. How can I focus the field without selecting the text? ...

How to delete a file whenever user leaves page?

I have a form with action set to a php-file (verify.php). In the form, I have made a pretty nice picture upload section. After submitting the form, the verify.php is opened to verify the form filled in by the user. The form values are all placed inside another form on the verify.php page. Only the image is uploaded to a folder on the se...

How to use jQuery to FIND & REPLACE given text with a matching URL instead

Hey there, in short I'm looking to parse a web page and find the text "class abc" and create a url like this: http://www.site.com/code/documentation/classes/classabc/index.html I'm basically gonna create links from my hosted svn code website to documentation I've generated via doxygen from the same codebase. ...

find top and last element inside a scrollable div

I have a scrollable div with a fixed height. While scrolling I need to get the element at the top of the visible viewport and the one at the bottom of the viewport. I can get the position of the scrollbar using scrollTop, however I am not sure how to get the element. Update: Formatted question for clarity. ...

Why is 'this' not updating to refer to a new object?

I'm writing an online game which allows a user to progress from one puzzle to the next, and if the user makes mistakes, each puzzle has a start again button to allow the user to start just that puzzle from scratch. A simplified version of the code's structure is below: function puzzle(generator) { this.init = function() { t...