javascript

Javascript (prototype) plugin to cycle through images

Can anyone recommend a javascript plugin that rotates some small images on a card. For an example of the functionality I want check out http://sortfolio.com Would prefer Prototype implementation, but JQuery could work also if necessary. I'm curious to see if there are any other cool implementations of this too (such as just hovering t...

How can I detect when a browser enters a stored password into web login

I have a website that detects when a user name and password has been entered, then enables the login button. The problem is if the browser enters the user name and password that it has remembered then the login button is never enabled. Is there a way in JavaScript to detect a browser entering this information? ...

Trouble with Cross Domain Iframes on IE8: changing parent.location forces new popup window. if on a click event, it works as expected.

Hi everyone, I'm having a lot of trouble getting cross domain iframe communication working. It's working on Firefox and Chrome, but on Internet Explorer, it only works in some ways: If the parent.location = 'new_hash'; is not encompassed in an onClick event, it forces the parent frame to open a new popup window. If it is in an onCli...

Javascript working in Java web browser?

is this possible? i have made a simple web browser, it can view some pages fine, but most are messed up, i believe it can be because of this (javascript not enabled). For example this is how CNN.com shows up: http://www.glowfoto.com/static_image/07-181402L/5111/png/07/2010/img5/glowfoto here is my code so far: public class Browser exte...

Find out where Jquery ajax request gets redirected to.

So- I've got this ajax request, see-. Blonde, about 6 feet tall, looks like this: $.ajax({ url: 'http://example.com/makeThing', dataType: 'html', type: 'POST', data: { something:someotherthing }, complete: function(request, status) { console.log("headers=" + request.getAllResponseHeaders();); ...

What does immutable mean?

If a string is immutable, does that mean that.... (let's assume JavaScript) var str = 'foo'; alert(str.substr(1)); // oo alert(str); // foo Does it mean, when calling methods on a string, it will return the modified string, but it won't change the initial string? If the string was mutable, does that mean the 2nd alert() would retur...

Javascript: Mysterious lag on multiple runs of function.

The following function simply returns an of elements with the specified tagname in the document. For some reason on successive calls to the function the execution of it gets slower and slower.. I have tested it thoroughly and the for-loop line in the cause, but I don't understand why that would cause a slow down on successive calls. fun...

Javascript/jQuery move to next field on keypress

When a user presses the down arrow key in a textarea, and it's the bottom of the textarea (i.e. the keyup has no effect), I'd like to an event handler to capture this. $("<textarea />").keyup(function (e) { switch (e.keyCode) { case 40: // down // if last line or alternatively // if keypress does not chan...

Shift js string one character

In PHP, it's pretty simple, I'd assume, array_shift($string)? If not, I'm sure there's some equally simple solution :) However, is there any way to achieve the same thing in javascript? My specific example is the pulling of window.location.hash from the address bar in order to dynamically load a specific AJAX page. If the hash was "2"...

How to grab textarea value, and maintain the HTML Styling

Hello, I'm building a comment module for my web application. In the application I need commenting. When a user posts a comment, I would like jQuery to grab the TextArea's value and then insert it into the page <p>. Problem is that when it inserts the contents it loses the HTML formatting, mainly page breaks/returns which confuses users....

For loops in JavaScript

This is my code function countdown(integer) { for i = integer, 0, -1 do { document.write(i); } } What I am trying to do is have a loop do what I want it to do, and what I want it to do is.. for i = integer, 0, -1 do i = The variable of the current loop integer = Starting the loop at the int...

Conditionally skip form fields from submission, Reduce URL clutter

I have multiple hidden form fields which store values about the the current view (e.g. if certain, normally hidden div's are visible etc.) to restore the layout when the form posts back. The problem is that I'm always submitting all these hidden fields, even if they are in default, generating lots of unnecessary URL clutter in the proce...

One Input - two styles? Left side cursor:text, right side cursor:pointer ?

Hello! Is there a way (using javascript/jQuery) to do following: On my page, I have one input type=text. This input has a background-image on its right side. <input id="my-input" type="text" value="foobar" style="background-image:url(path/to/my/image.gif); background-position:right center; background-repeat:no-repeat; height:17px; widt...

Script error in retrieving tree node text

I got a script error when given to display the ASP.net TreeView node text as "alert(event.originalTarget.text)". The error is shown as "originalTarget.text is null or not an object". $(document).ready(function() { $(".treeNode").draggable({helper:'clone'}); $("#<%=TreeView1.ClientID %>").droppable({ drop: fun...

window.open in javascript?

<head> <script language="javascript" type="text/javascript"> function openMe() { var win = window.open("about:blank"); var str=""; for(var a in win){ str+=a+"<br/>"; } document.getElementById("data").innerHTML = str; win.document.write("Karandeep Singh"); } </script> </head> <body> <div> <inp...

Javascript templates

Hello, Does anyone know if is there any way to create javascrit templates in Genshi? I mean, I need a .js file where I can use directives like <py:for> and so. Any idea? Thanks! ...

How can I prevent the subframe from changing "top.location.href "

There are some pages have such javascript: <script language="javascript"> if (top.location != location) top.location.href = self.location; </script> If I have a web page with a frame, linked to those pages, when they loaded, the url of the browser will be changed to their urls. I don't want this, what can I do? ...

Algorithms for Directed Cyclic Graph Traversal (JavaScript)

I have a connected, directed, cyclic graph. The task is to discover every single node in the graph without falling into an infinite loop, as a regular tree traversal algorithm will do. You can assume that I already know what node to start at so as to reach all points in the directed graph, and that for each node I have a function that w...

Detect Mouse Button for FireFox in Javascript

What is the best way to go about detecting what button has been pressed in a DIV in FireFox using javascript? ...

How does this JavaScript statement calculate the date?

So I was looking at how I could display a Desktop Notification using a Google Chrome extensions when I came across these lines of code: var time = /(..)(:..)/(Date()); // The prettyprinted time. var hour = time[1] % 12 || 12; // The prettyprinted hour. var period = time[1] < 12 ? 'a.m.' : 'p.m.'; // The period...