javascript

Need UserVoice feedback page functionality

I like the feedback link that's static while the page scrolls and I want to add something similar to my site. See www.bind.pt, right side, for example. However I don't want to use UserVoice. I want to use a popup window with a form-to-email functionality. Is there a similar sample asp.net component or Javascript that's available for a l...

What is the correct way to detect Opera using jQuery?

Amazon.com recently updated their javascript, and it's causing problems with some Opera browsers. Their browser detection code looks like so, but it's faulty: function sitbReaderIsCompatibleBrowser() { if (typeof(jQuery) == 'undefined') { return false; } else { var version = jQuery.browser.ve...

How can I register a C# variable value to a Javascript variable every time an event is fired.

I have an event handler in C# code-behind for an .aspx page. Each time this event handler fires I want it to update a Javascript variable. I thought I could do something like this. int scale = (int)myObject.Scale; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "JSVariables", "scale=" + scale, true); However, as it was p...

Clipboard management with websites

Hello, I would like to know how to put text into the clipboard like some popular sites are able to do. I saw a cross browser way to do it using flash, but it wont work with the current version? I have seen sites like www.photobucket.com and www.hulu.com have made copying to the clipboard automatic and cross browser. Please help. Thanks ...

AJAX and Javascript cache efficiency question

I am building a simple blog which is viewed single-page (do not worry, it is progressively built) and thus I am sending AJAX requests which return HTML to be inserted into the page. What is the most efficient way to store/cache information (HTML) to be added at a later time into the DOM? How much information (old entries which the user...

Can I update window.location.hash without having the web page scroll?

Using JavaScript, is there a way to update window.location.hash without scrolling the web page? I have clickable title elements that toggle the visibility of a div directly beneath them. I want the /foo#bar in the history when clicking titles but don't want the page scrolling about. So when navigating away from /foo#bar I'll be able to ...

creating dynamic form elements (with incremented name attributes)

How can I dynamically create a form element and provide it with dynamically incremented input name attributes? I'm working with jquery but am open to any solutions. I have a div that looks like this: <div> <input type="text" name="title1" /> <input type="text" name="body1" /> <select name="photo1" size="1"> <option value="0">foo</o...

Calling typeface.js on HTML fetched by jQuery?

I have a page where I'm fetching a Wordpress main index to handle my 'news feed', imported via jQuery.ajax. I'm also using typeface.js on the same page to have better typeface control. I want to call typeface.js on the elements in the Ajax'd HTML. The problem is that I'm not sure how to do that, since the structure of it is unfamiliar...

Fast Javascript Table sorter?

Hello, I have a table with about 250 rows (may double within 6 months), and 50 columns on this page (warning: slow with IE). I'm using the JQuery Table sorter. But it is too slow with IE 7: it gives a warning about a slow javascript, and ask if I want to stop it. I've spent a lot of time to improve performances, so it works fine for all ...

JQuery click() strange behavior

I want to make a simple photo gallery function. However, there are some strange behavior of JQuery's click(). After the user clicks the forward button, 10 next images should be shown. After the user clicks the backward button, 10 previous images should be shown. In the following code, 4 lines which works fine in my code are commented...

document.viewport.getHeight() inaccurate?

OK, regarding... the demo of Scriptaculous' Effect.Move which can be found here <style type="text/css"> a#move_demo { background:#fa0000; color:#fff; padding:5px; border:1px solid #000; } </style> <div class="demo"> <a href="#" id="move_demo" onclick="new Effect.Move(this, { x: 60, y: -30 }); return false;">Click me for a demo!</a>...

Mimic Window. onerror in Opera using javascript

I am currently working on a web application, I have a JS logging mechanism that Handles Javascript error that are not caught by the js code inside the page. I am using window.onerror to catch all such errors and log them else where. However, Problem is with Opera which does not have window.onerror event. one approach I could think of is...

What's the best Javascript tutorial?

May I know the best Javascript tutorials? Site links, books, video tutorials perhaps? ...

DOM memory and CPU management

I am creating a progressively built single-page (if Javascript is enabled) "blog" which uses AJAX to request HTML for new pages the user is navigating to. When the user navigates to new pages they will be added one after another into the DOM in a small window with "overflow: hidden;": <div id="foo" style="width:200px; height:100px;"> ...

How can I check whether a option already exist in select by JQuery

How can I check whether a option already exist in select by JQuery? I want to dynamically add options into select and so I need to check whether the option is already exist to prevent duplication. Thanks for any help. ...

How to subscribe for an javascript event form Flex 3 action script code?

Hello, everyone. We have that Flex app talking to the server. We need some kind of *FlexEvent.ON_BROWSER_WINDOW_CLOSE* event but, unfortunately Flex does not provide such. So I've got the advice to catch a javascript "onbeforeunload" event and call the flash client thru the ExternalInterface-registred method. Is there any way to subsc...

Eval is evil... So what should I use instead?

An ajax request returns me a standard JSON array filled with my user's inputs. The input has been sanitized, and using the eval() function, I can easily create my javascript object and update my page... So here's the problem. No matter how hard I try to sanitize the inputs, I'd rather not use the eval() function. I've checked google for...

Programmatically selecting partial text in an input field

How can I programmatically select a specific range of text in an HTML input field? (I don't want to select the entire field, just a subset) Also, how can I determine the currently selected range in a field? ...

javascript startswith

how would i write the equivalent of c# startswith in javascript? var data = 'hello world'; var input = 'he'; //data.startsWith(input) == true ...

XSL tags inside javascript block

Hi, I need my XSL to add dynamic content to a javascript block. I am wondering if this is possible. Here is an example of what I want to do. The following code does NOT work: <script> // Loads the video. var s1 = new SWFObject("player-viral.swf","ply","670","350","9","#ffffff"); s1.addParam("allowfullscreen","true"); s1.addParam("a...