javascript

ASP.net Adding Mouse Over To a Grid Control Cell

Is it possible to add a java script mouse over to a grid control cell? If so, how do you do it? Specifically, we're trying to show a different tool tip for each cell, not the entire column or row. ...

Javascript / JQuery: refresh tab in parent

Hello, I have a (parent) window containing JQuery tabs: <div id="tabs"> <ul class="tabHeader"> <li><a href="?ctrl=doSomething" title="#tabs-something"> Awesome function</a></li> <li><a href="?ctrl=showSettings" title="#tabs-showSettings"> Settings</a></li> </ul>...

How can I mirror text selection?

Say you have two inputs: <input id="input1" type="text"/> and <input id="input2" type="text"/> such that through some JavaScript magic, anything you type in input1 will also be put in input2. In this sense input2 "mirrors" input1. Is there a way that I can also "mirror" text selection. So if I select some text in input1, how can I hav...

What is the most performant way to inject new code into the DOM?

Hi. I am engaged in a small debate with the server side developer for my project (I'm the front end guy) around injecting new stuff into DOM. He maintains that the best method to inject a large amount of code (received via ajax) is to send a JSON object and then to iterate through each item of that object. He says that will save some ba...

Preloading @font-face fonts?

Is it possible to preload or otherwise cache @font-face fonts, most likely with javascript, before the page loads so you don't get that ugly jump when the page finally does load? ...

ValidationSummary with Client Side & Server Side Validation

Hey, If you use a CustomValidator control and a ValidationSummary control within an aspx page for server side validation you can set the ErrorMessage of the validator and its Text value will appear in place and the ErrorMessage value will be displayed within the ValidationSummary control. Nice. Now, what if I also perform validation o...

Really Custom Reporting in Google Analytics

I have a client who is currently using WebTrends for their analytics, and is considering making a move to Google Analytics. However, from what I can tell, there is very little custom reporting available in GA. For example, if a user was logged into the system, and I wanted to be able to do reporting on people with blue eyes, brown hair...

Returning an Javascript Object's property by Value NOT Reference

So I have a class foo that has a method which returns an array bar. I have another function that calls foo.getBar and then filters the array. I want to be able to always get the original contents of bar when I use a different filter, but bing seems to be just creating a reference to bar, not a separate array. I have tried using return th...

javascript binary search tree implementation

Anyone know of any good examples of a simple BTree implementation in Javascript? I have a bunch of "things" arriving randomly, and want to insert each one efficiently. Ultimately, each new one will get inserted into the DOM based on where it ends up in the tree. I can code this from scratch but would rather not reinvent any wheels. t...

Window.Print() Not working in FF3

I am trying to print a portion of the page in FF3. This works fine in IE7. In FF, the page correctly changes to the part I am trying to print, but the Print Dialog never appears. Here is my code: function PrintPage() { var fullPage = document.body.innerHTML; document.body.innerHTML = document.getElementById('content').innerHT...

How should I associate server-side data with client-side UI elements in HTML?

I run into this problem constantly while developing AJAX applications. Let's say I want users to be able to click on a "flag" icon associated with each comment on my site, which results in an AJAX request being sent to the server, requesting that the comment be flagged. I need to associate a comment id with the comment on the client side...

Access outside variable in loop from Javascript closure

See: for (var i in this.items) { var item = this.items[i]; $("#showcasenav").append("<li id=\"showcasebutton_"+item.id+"\"><img src=\"/images/showcase/icon-"+item.id+".png\" /></li>"); $("#showcasebutton_"+item.id).click(function() { alert(item.id); self.switchto(item.id); }); } The problem is that the ...

jQuery appended text is invisible

I'm trying to create a couple of buttons above a textarea to insert some HTML code -- a VERY poor-man's HTML editor. I have a couple of INPUT elements, and I'm using jQuery to set a click handler that will call's jQuery's append() or html() or text() functions. The handler fires, it shows a debug alert(), but the text I'm trying to app...

Why are IE and Firefox returning different overflow dimensions for a div?

I have a div with a fixed size of 100px. scrollWidth and scrollHeight works fine if the text in the div is normal (no word is long enough to fill the one row entirely). However, if there is any text with one word rendering wider than the 100px it will cause a problem. Let's say the text is like "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890": t...

Geolocation using hostip with javascript

This is probably a very silly question. I am trying to do a geolocation to find a users address based on their ip address using the api provided by http://www.hostip.info/use.html. I am using this in conjuction with jquery with the following code: $.get("http://api.hostip.info/get_html.php", function(data){ alert("Data Loaded: " + d...

Best way to display this in a form?

On my website, I have two tables which are linked using a pivot table. What I am trying to do is let a user update the relationships between the two tables (inserting and removing records from the pivot table). I have no problem doing this in PHP, but what I am concerned about is the way the form is displayed in the users web browser. T...

How to capture user interaction with a website?

How can I capture user interaction on a website? How many links a user has clicked. From where user has come. I want to create my own logic. I don't want to use any statistics tool. How can I accomplish this? Thanks in advance ...

Referencing parent window from an iframe on a modal popup

I am using the AJAX modalpopupextender and I have an iframe embedded in the modal popup. I need to be able to reference the parent window (the window from which the modal popup was launched) to reload/change the URL when certain events on the modal popup are fired. I have tried window. top, window.parent, opener, root, etc., and have h...

Firefox extension to modify HTML

I want to create a Firefox extension that creates a toolbar button with 2 options - on and off. When On is selected, I want to check if the user is on a specific domain(s) (e.g. www.xyz.com/page1.html) and if he is, I want to edit html of that page and add insert a Javascript entry in that page. I also want to change all the textarea ta...

The jQuery treeview plugin doesn't work within a jQuery accordion plugin

I am currently using the jQuery accordion plugin, and I need to use the treeview plugin within the accordion. However this doesn't work, and it seems to be a known problem (try googling "jquery accordion treeview"). Are there any plugins that might replace treeview but provide me with a similar flexible tree-like navigation behaviour? (...