Category: script

H

How to disable text selection in a table

When the user drags the mouse over the rows, the row text gets selected, looking a bit awkward. Check the image below: In order to prevent the user from doing these selections and to keep the rows integrity, we can use the following options: CSS Fix -  works with all browsers except IE Controlling KeyEvents ...

j

jQuery to check the row count of a table

To get the row count of the table, in jQuery, all you need to do is use any of the following approaches: $("#mytable tr").length $("#mytable tr").size() //But the size method calls the length property internally One thing to be noted here is that the indexing is 1-based and not 0-based. For ex.: <html> <head> <script ...

S

Styling a file upload control or input type = “file”

FileUpload control has weird styles, especially when you view them across browsers. The normal look and feel of the control, would look like something below: The Safari one looks really worth a bug for the testers. This solution to style fileupload controls is a concise and verified version of the solution by Michael McGrady. Step ...

P

Page refresh leading to larger font size when using popups

Well this was one error i faced during on of my development projects. I have a button click firing a ShowModalDialog window. On close of that window, i want the parent to refresh. But the problem was that, when i close the dialog box or popup, the parent page finishes its loading and shows up ...

L

Learn jQuery: A simple ‘Hello World’ jQuery Code

jQuery - A powerful javascript library capable of doing all your complex javascript actions and functionality in a line or two. How cool is that. Pre-requisites : Notepad, jquery.js file(You can get it here),  some coding background and an open mind Let's Start with a simple Hello World: Open your notepad, create a html file ...

_

__doPostBack and Object expected error

The best way to understand the working of the __doPostBack function is to dissect the function into small pieces and explore each piece one at a time.  Let us take a look at the function. <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() ...

A

ASP .Net Menu using ordered list – ul, li concept

I give a different approach to menu creation, in my ASP .Net project. The main wins being the performance and ease of use. Asp menu is pretty messy when you look at the code behind and the page size it adds. But use this concept only if performance is a critical factor. Concept: •    Use ...

j

jQuery : To check if an element is present in the page or not

This is a precautionary measure that you can adopt, if you are doubtful about the presence of a particular control in the page. Under normal scenarios, in case if the element is not there, it would throw an error. But you can now check if that particular element is present in the page or not, ...

j

jQuery Intellisense for VS 2008

Found this weblog from ScottGuru very useful. You can now add intellisense to the jquery code that you write in your web Application. http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx Enjoy jQuery to its full!

H

How to determine whether Javascript is enabled?

There are a lot of approaches to this. Lets take them one at a time: Using NOSCRIPT tag: You can write a noscript tag just before your script tag to display the user a warning message. Check the code below, wherein the user will be redirected to another page if javascript is disabled: <html> <head> ...