| JQuery Checkbox Example | |
| <html> <head> <script src="jquery.js"></script> <script> $(document).ready(function() { $("#selectedValue").click(function() {    var values=[];    $("input:checkbox[name=lang]:checked").each(function() {       values.push($(this).val());    }); for(i=0;i<values.length;i++) {    alert(values[i]); } }); $("#selectedText").click(function() {    var values=[];    $("input:checkbox[name=lang]:checked").each(function() {       values.push($(this).prev().text());    }); for(i=0;i<values.length;i++) {    alert(values[i]); } }); $("#selectedIndex").click(function() {    var values=[];    $("input:checkbox[name=lang]:checked").each(function() {       values.push($(this).index());    }); for(i=0;i<values.length;i++) {     alert(values[i]); } }); }); </script> </head> <body> <div> <label for="telugu">Telugu</label> <input type="checkbox" name="lang" value="telugu"/> <label for="english">English</label> <input type="checkbox" name="lang" value="english"/> <label for="hindi">Hindi</label> <input type="checkbox" name="lang" value="hindi"/> </div> <button id="selectedValue">Selected Value</button> <button id="selectedText">Selected text</button> <button id="selectedIndex">Selected index</button> </body> </html> | |
Tuesday, 13 August 2013
JQuery Check box Example
Tuesday, 30 July 2013
JQuery Radio Button
//To uncheck by default checked radio button
$("input:radio[name='radioButtonName']").attr("checked",false); |
//To check particular radio button with starting index 0 or 1 or 2
$("input:radio[name='radioButtonName']")[0].checked = true; |
//To get the value of selected radio button
$("input:radio[name='radioButtonName']:checked").val(); |
//To get the text(display text in radio button label) of selected radio button
$("input:radio[name='radioButtonName']:checked").parent().text(); |
//To get the index of selected radio buttons
var temp = $("input:radio[name='radioButtonName']");var selectedIndex = temp.index(temp.filter(":checked")); |
| EXAMPLE PROGRAM |
| <html> <head> <style> .addSelColor { color: red; } .MyCssClass { background-color: green; cursor: pointer; border: 2px solid yellow; } </style> <script src="jquery.js"></script> <script> $(document).ready(function() {   alert("Jquery is Loaded"); $("input:radio[name=sex]").change(function() {   alert($(this).val());   $(".radioClass").parent().removeClass("addSelColor"); //for css   $(".radioClass:checked").parent().addClass("addSelColor"); //for css }); $("#ClearButton").click(function() {   $("input:radio[name=sex]").attr("checked",false); }); $("#selectMale").click(function() {   $("input:radio[name=sex]")[0].checked = true;   $(".radioClass").parent().removeClass('addSelColor'); //for css   $(".radioClass:checked").parent().addClass('addSelColor'); //for css }); $("#selectFemale").click(function() {   $("input:radio[name=sex]")[1].checked = true;   $(".radioClass").parent().removeClass("addSelColor"); //for css   $(".radioClass:checked").parent().addClass("addSelColor"); //for css }); $("#hideButton").click(function() {   $("#radioDiv").hide(); }); $("#showButton").click(function() {   $("#radioDiv").show(); }); $("#getVal").click(function() {   var temp=$("input:radio[name=sex]:checked").val();   alert(temp); }); $("#getText").click(function() {   var temp=$("input:radio[name=sex]:checked").parent().text();   alert(temp); }); $("#getIndex").click(function() {   var temp = $("input:radio[name=sex]");   var selectedIndex = temp.index(temp.filter(":checked"));   alert(selectedIndex); }); $("#acss").click(function() {   $("label[for=male]").addClass("MyCssClass");   $("label[for=female]").addClass("MyCssClass"); }); $("#rcss").click(function() {   $("label[for=male]").removeClass("MyCssClass");   $("label[for=female]").removeClass("MyCssClass"); }); }); </script> </head> <body> <div id="radioDiv"> <label for="male"> <input type="radio" class="radioClass" name="sex" value="BOY" checked>MALE<input> </label>   <label for="female"> <input type="radio" class="radioClass" name="sex" value="GIRL">FEMALE</input> </label> </div></br>   <button id="ClearButton">Reset</button></br>   <button id="selectMale">Male</button></br>   <button id="selectFemale">FeMale</button> </br>   <button id="hideButton">Hide Radio Buttons</button></br>   <button id="showButton">Show Radio Buttons</button></br>   <button id="getVal">Get Selected Value</button></br>   <button id="getText">Get Selected Text</button></br>   <button id="getIndex">Get Selected Index</button></br>   <button id="acss">ApplyCss</button></br>   <button id="rcss">RemoveCss</button></br> </body> </html> |
Saturday, 13 July 2013
Different ways to work with jQuery...
| ->First we have to download/copy JQuery code(In this blog already link is available). |
| ->Place that code in one text file and save with the extension .js(Ex->jquery.js) |
| ->create one html file and give this jquery.js file path in script tag(<script src="jquery.js"></script>) |
| ->write jquery code in the script tag |
| ->We can use following ways to work with JQuery |
| $(document).ready(function(){          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| jQuery(document).ready(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| window.jQuery(document).ready(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| window.$(document).ready(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); | $(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| jQuery(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| //We can use any name instead of $ var ram=$.noConflict(); ram(document).ready(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| var ram=$.noConflict(); ram(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| var ram=$.noConflict(); window.ram(document).ready(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| var ram=$.noConflict(); window.ram(function() {          alert("WELCOME TO JQUERY");          //write JQuery code here }); |
| EXAMPLE PROGRAM |
|---|
| <html> <head> <script src="jquery.js"> </script> <script>     $(document).ready(function() {          alert("AFTER LOAD THE PAGE THIS JQUERY CODE IS EXECUTING");          //WRITE ANY JQUERY CODE     }); </script> </head> <body> HOW TO WORK WITH JQUERY </body> </html> |
Saturday, 6 July 2013
All Java Versions
J2SE:
            JDK 1.0 (January 21, 1996) Java Development kit
            JDK 1.1 (February 19, 1997)
            J2SE 1.2 (December 8, 1998) Java Standard Edition
            J2SE 1.3 (May 8, 2000)
            J2SE 1.4 (February 6, 2002)
            J2SE 5.0 (September 30, 2004)
            Java SE 6 (December 11, 2006)
            Java SE 7 (July, 2011)
            Java SE 8 (March, 2014)
            Java SE 9 (Sep 21, 2017)
            Java SE 10 (March 20, 2018)
            Java SE 11 (Sep 25, 2018)
            Java SE 12 (March 19, 2019)
            Java SE 13 (Sep 10, 2019)
J2EE:
            JPE (May 1998) Java Professional Edition
            J2EE 1.2 (December 12, 1999) Java Enterprise Edition
            J2EE 1.3 (September 24, 2001)
            J2EE 1.4 (November 11, 2003)
            Java EE 5 (May 11, 2006)
            Java EE 6 (Dec 10, 2009)
            Java EE 7 (May 28, 2013)
            Java EE 8 (Aug 31, 2017)
            JDK 1.0 (January 21, 1996) Java Development kit
            JDK 1.1 (February 19, 1997)
            J2SE 1.2 (December 8, 1998) Java Standard Edition
            J2SE 1.3 (May 8, 2000)
            J2SE 1.4 (February 6, 2002)
            J2SE 5.0 (September 30, 2004)
            Java SE 6 (December 11, 2006)
            Java SE 7 (July, 2011)
            Java SE 8 (March, 2014)
            Java SE 9 (Sep 21, 2017)
            Java SE 10 (March 20, 2018)
            Java SE 11 (Sep 25, 2018)
            Java SE 12 (March 19, 2019)
            Java SE 13 (Sep 10, 2019)
J2EE:
            JPE (May 1998) Java Professional Edition
            J2EE 1.2 (December 12, 1999) Java Enterprise Edition
            J2EE 1.3 (September 24, 2001)
            J2EE 1.4 (November 11, 2003)
            Java EE 5 (May 11, 2006)
            Java EE 6 (Dec 10, 2009)
            Java EE 7 (May 28, 2013)
            Java EE 8 (Aug 31, 2017)
Differences between Java Compiler,JIT Compiler,Java Interpreter
Java Compiler->Java compiler just convert .java programs into .class files,
                   that means converting our source code into byte code.
JIT Compiler->JUST IN TIME COMPILER is the part of the Java Virtual Machine (JVM)
                   that is used to speed up the execution time. JIT compiles parts of the byte code
                   that have similar functionality at the same time, and hence reduces the amount of
                   time needed for compilation. Here the term “compiler” refers to a translator from
                   the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.
Java Interpreter->JAVA INTERPRETER converts total Byte code into machine dependent code,
                   If JVM use only interpreter the performance of JVM will slow,
                   so JVM uses JIT compiler and Interpreter both.
Differences between JDK,JRE and JVM
JDK->JAVA DEVELOPMENT KIT is used to develope the java programs,
         It creates the environment in our machine to develope java programs.
         JDk includes compiler,this compiler converts our source code(.java) to byte code(.class).
JRE->JAVA RUNTIME ENVIRONMENT is used to run the java programs(.class).
         JRE is the implementation of JVM,So JVM internally uses JRE to execute programs.
JVM->JAVA VIRTUAL MACHINE convert byte code to different machine dependent codes,
         JVM interanlly uses JRE.JRE is the implementation of JVM,
         JVM implementation is depends on OS.
      ->Responsibilties of the JVM
         To load the code
         To verify the code
         To Convert the code
         Execute the code
Subscribe to:
Posts (Atom)



