javascript

clicking any link at the bottom scrollbar "snaps" to the top of page.

i have this annoying problem with my site where, when you click on a dummy link or checkbox at the bottom of the pages, the scrollbar snaps back to the top. i have to scroll down again, to keep clicking. ...

How to set the default (submit) button for a page loaded in an iPhone UIWebView (stringByEvaluatingJavaScriptFromString?)

Hi, I'm using a UIWebView to load an HTML form in my iPhone app. The form has three submit buttons (and selecting "Go" on the iPhone keypad selects the first submit button). I'm assuming that I can set a different "default" submit button with Javascript injection into the downloaded form, but I don't know Javascript well. Does anyone...

How to expose IFrame's DOM using jQuery?

Hey.. I have a prototype representing a particual IFrame. That prototype have a function called GoToUrl(...) that opens the given url within the IFrame. My question is: How do I create an "InternalDOM" property and make this property refer to the "window" object (the root DOM object) of the IFrame inside? In such way that: If my IFrame ...

Cartesian (non parametric) form of Bezier curves

Hi Guys, I needed to find and use the coordinates of the intersection of a cubic Bezier and a straight line. The trouble is that I cannot find a non-parametric representation of a Bezier curve which I need for solving with the line. I do not want to resort to a Newton-Raphson equivalent on the Bezier parametric equation (which can be f...

Is it possible to develop completely 'javascript-free' website or web-application ?

Hi, I'm an ASP.NET developer having started long back in classic ASP. In Classis ASP everything had to be done manually, no smart-debugging support and not so great IDEs like VS [except DreamWeaver]. Just a 'subjective' thought as it came in I wish to discuss it here as 'community-wiki'. Is It possible to develop completely 'javascript...

getClientRects javascript method supported on iPhone?

Trying to find the top-most visible element in a UIWebView. I am using a JS method to do this, which works great in Safari, but never executes past the getClientRects method when executed from a UIWebView. The elements I'm interested are all of class="h". Here's the javascript which is called from [webView stringByEvaluatingJavaScript...

Using JavaScript "Regular Expression" in Asp.Net

I want to check password strength of password entered by user in Asp.Net page. I have comeup with a javascript regular expression to do it. But I am not sure How to match string using regular expression. I have write this code, but its not working. I think there is an error in line if (true==checkspace.exec(password)) alert...

Display unordered list as a horizontal binary tree

Hi, I have a binary tree in unordered list that looks like this: <ul> <li>1 <ul> <li>2 <ul> <li>4 <ul> <li>8</li> <li>--</li> </ul> </li> <li>5</li> </ul> </li> <li>3 <ul> <li>6</li> <li>7</li> </ul> </li> </ul> </li> Where -- is a empty space (to differ ...

Are Arrays as lvalues in JavaScript ECMAScript-compliant?

Firefox 3.5.3 (at least) allows me to write code like : var array = [4, 5, 6]; var foo, bar, baz; [foo, bar, baz] = array; at which point foo => 4 bar => 5 baz => 6 which can be quite helpful for code clarity. Is that considered ECMAScript-compliant? I didn't see anything in the specification, but JSLint returns an error. ...

how to show gridview row in zoom

work on asp.net vs05.i want to set mouse event on gridview Then based on the event type if event is mouseover it zoom the row else if the event is mouseout it changes the row’s zoom back to its original before the event occurred. if (e.Row.RowType == DataControlRowType.DataRow ) { e.Row.Attributes.Add("onmouseover","MouseEvents(...

How to get the bounding box of a wrapping inline element with prototype.

I used to use cumulativeOffset() and getDimensions() to calculate the bounding box of elements, but just realized that cumulativeOffset returns the top left corner oft the start of an element. Meaning: if an inline element wraps, and the next line is more to the left than the start, I get a displaced bounding box. After researching a bi...

jQuery/Javascript - how to detect that image was re-loaded

Hi, I have a several actions that can be taken on the screen that would cause image to be re-loaded via Ajax call (non-jQuery). I need a way to detect that image has been reloaded so that I can attach event handler to the image again. How can I do this? ...

using ternary operator in javascript to invoke two functions?

So can this be done in Javascript? type == 1 ? function1() : function2(); ...

Debug embedded javascript file

There is a class library project with embedded javascript file, with a lot of functions (clint-side implementation), is it possible to debug them? If I set breakpoints inside this file, they never break. ...

Javascript: Redirect

Hello, I have a problem: I want to redirect via JavaScript to a directory above. My code: window.location.href = (location.href).substr(0, (location.href).lastIndexOf('folder')); The url looks like this: domain.com/path/folder/index.php?file=abc&test=123&lol=cool The redirect affect just this: domain.com/path/&test=123&lol=...

What's a good command line JavaScript code beautifier?

I recently asked a question about formatting JavaScript code in Vim. And I've also noticed this question, and did some Google searching. Nonetheless, my quest continues. I've given up on a Vim plugin that will properly format contemporary JS code. But maybe there's a command line tool I could call from within Vim. Here are my desiderata...

Way to tell if a section of the page is visible to the user?

So I have a JS function that displays a widget at the bottom of the page. The JS function makes a call to the server to get information to display but I have a theory that most of the people on certain pages never scroll down to even see the widget so i don't want to waste the bandwidth and cycles to render it if it's not going to be se...

google reader json image

i'm using json to read shared google reader items. But item not contain image link. only contain [image: imagename] on content field . How can get image url? ...

Use variable value to get value stored in other variable

I am trying to simplify some of the bookmarklets that I have created over the past few days and make them easier for people to use. One of my bookmarklets changes the selected option in a form select field. I would like to able to write it as: javascript:(function(){setSelect('yourMom'); ...boringStuffThatThey'llMessUp ...})(); functi...

Fb:share-button with json attachment?

I've got some code right now that reliably produces the json I need formatted just the way I like it for my facebook app's streamPublish FBJS call. Now I'm playing with facebook.connect and I would like to just reuse the same json . I noticed the XFBML tag: <fb:share-button> while exploring facebook.connect, and thought that this woul...