Category: JavaScript

JS or Js may stand for JavaScript The filename extension .js is used for JavaScript and JScript files

List Changer

This is a very simple background changer. It just takes the selected value from the list and makes that the background color. Insert the following code inside the <body> tag: <FORM><SELECT Size=5 name=clr onChange=”document.bgColor=this.options[this.selectedIndex].value”><OPTION VALUE=”blue”>blue<OPTION VALUE=”aquamarine”>aquamarine<OPTION VALUE=”chocolate”>chocolate<OPTION VALUE=”darkred”>dark red<OPTION VALUE=”gold”>gold<OPTION VALUE=”red”>red<OPTION VALUE=”yellow”>yellow<OPTION VALUE=”hotpink”>hotpink<OPTION VALUE=”lime”>lime<OPTION VALUE=”darkkhaki”>dark khaki<OPTION VALUE=”cadetblue “>cadet blue<OPTION VALUE=”darkgoldenrod”>dark goldenrod<OPTION VALUE=”darkslateblue”>dark slate<OPTION VALUE=”blue”>blue<OPTION VALUE=”deeppink”>deep …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/03/list-changer/

Warning before navigate away from a page

In some cases, if you are in between any work of editing or typing a content, and you wont let the visitor to navigate away from the page without particular condition, say the document is not saved yet, you can block the navigation (even the closing of the browser window) with Javascript. Code: window.onbeforeunload = …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/02/warning-before-navigate-away-from-a-page/

jQuery Traversing Tips

Just a quick review of tips available in jQuery to manage nodes (contents) near by the content / node which is triggered an event like click, hover etc Functions: find, parent, parents, children, first, last, closest Suppose you need to manage some nodes nearby a link or a button on an event. Say $(‘.button’).click(function(){ // …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/02/jquery-traversing-tips/

How to avoid Conflict in jQuery

Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery’s case, $ is just an alias for jQuery, so all functionality is available without using $. If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/how-to-avoid-conflict-in-jquery/

Tips for using jQuery

Find if something is hidden: We use .hide(), .show() methods in jquery to change the visibility of an element. Use following code to check the whether an element is visible or not. if($(element).is(“:visible”) == “true”) { //The element is Visible } Center an element on the Screen: To make align the element to center. jQuery.fn.center …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/tips-for-using-jquery/

SlideShow using jQuery

Creating Image Slide Show using jQuery: In the code below you will see a surrounding div (id slideshow-area) which holds our slideshow content scroll area and our next and previous buttons. Inside our scroll area we have a div to hold the content and finally the content itself. As far as html goes this is …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/slideshow-using-jquery/