Skip to main content

Javascript




Hello and welcome to tutorial of Javascript

First program of Java script 
This is the very basic proram of Java script.............!!!!!
let's start
Open text editor and type folowing code.........
<html>
<body>

<script type="text/javascript">
document.write("This is my first JavaScript!");
</script>

</body>
</html>
it will simply print
->This is my first JavaScript!

Select all check box using one check box



  •          Here we are going to create a page that contains 6 check boxes. 

  •          And 2 other checkbox which we use for selects all and deselect all.


  •          Now open your favorite PHP text editor and type following code.


  •          Here I am going to create a webpage that contain 6 Language.

 

<body>

 

<p>Pls Select languages you know;</p>

 

<form name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">

 

  <?php

 

  print"<pre>";

 

  print"<input type='checkbox' name='lang[]'  value='C'>C<br>";

 

  print"<input type='checkbox' name='lang[]'  value='c++'>C++<br>";

 

  print"<input type='checkbox' name='lang[]'  value='Java'>JAVA<br>";

 

  print"<input type='checkbox' name='lang[]'  value='V.B.NET'>V.B.NET<br>";

 

  print"<input type='checkbox' name='lang[]'  value='ASP.NET'>ASP.NET<br>";

 

  print"<input type='checkbox' name='lang[]'  value='c sharp'>C Sharp<br>" ;

 

  print"<input type=checkbox name='ckeckall' value='ckeckall' onclick='checkall(checkall)'>Select

All<br>";

 

  print"<input type=checkbox name='ckeckall1' value='ckeckall1'

   onclick='uncheck(uncheck)'>UncheckALL<br>";

  print"</pre>";

  ?>

</form>

 

  • Save this file as index.php.

 

 

 

 

 

 

·         Here our design Part has finished.

 

 

  •          Now we are going to add javascript for select all checkboxes using one check box .

  •           Add following code to index.php in between <head></head> head tag.

 

 

<head>

<script language="javascript">

 function checkall(chkall)        //  Function for select all check box.

 {

       var chk=form1.elements;

      for(var i=0;i<chk.length;i++)

     {

          if(chk[i].type="checkbox")

                 {

                       if(chkall.checked=true)

                     chk[i].checked=true;

                     else

                       chk[i].checked=false;

                                                                                                       

                 }

        }

  }                                                            // finished

 

  function uncheck(uc)  //Function for deselect all

 {

            var chk1=form1.elements;

           for(var i=0;i<chk1.length;i++)

              {

                        if(chk1[i].type="checkbox")

                 {

                          if(uncheck.checked=true)

                          chk1[i].checked=false;

                          else

                        chk1.checked=true;

                }

                }

}      //finished                                                                                                                                              

</script>

</head> 

  •    Now save this file. 

  •    Open your favorite browser and run this file.

 

 

 

·         Now here you can see when we click on select all check boxes all the check will select.

·         Now click on uncheck all, all the check box will unchecked.

·         Here our tutorial for select and deselect using checkbox now over have fun with PHP.

Comments

Popular posts from this blog

13 VSCode Extensions That Every Web Developer Should Use

These are the most common extensions at VSCode that may be useful for you Almost every Web-Developer knows what VSCode is and why is it so important to use its extensions, they help us to debug our code, make it more readable and prettier, and just add more useful features to our workspace Of course, there’s not every useful extension, however, I have added 13 extensions without which I just can’t live. 1. Auto Close Tag It’s one of the most important extensions, As you may have noticed from the title, it automatically adds a close tag that you wanted to write. You don’t need any command to activate this extension 2. Auto Rename tag When you want to change your <button> tag to <a> you just will need to change the first(opening) tag and the second will change automatically 3. Beautify The function of it is straightforward— when you have an ugly file without any “spaces” and “tabs”, where every tag goes right after earlier, beautify will really help you To use this extension

8 VS Code Plugins To Improve Your Productivity

  VS Code is a great editor that ships with many features out of the box. That is one of the reasons why it’s the most used IDE. However, there are some areas where it can be improved — and that’s where extensions come into play. I’m not a big fan of having many plugins installed. There is always the risk of making your editor slower or introducing too much magic into your daily routine. You still need to be in the driver’s seat. That’s why I try to stay as close to the raw features as possible. I have no more than ten plugins installed at any given time. I try to be very tidy there. If you installed something and you feel it is not helping, just delete it. It might be distracting you or impacting performance. However, there are some very specific extensions that will have a very important impact on your productivity. I want to focus on those in this article. You are most likely not going to need them all, as your workflow might be different than mine, but you might discover something

5 Common CSS mistakes developers make

If you are starting your carrier as a web developer, CSS is a headache for many developers, based on my experience. It takes time to learn it and master it. This article is covering some common mistakes that you may face when writing CSS code. Ready, let’s go! 1. Using px when it’s not needed⁣   Do you know that you don’t need to use px when you want to set the a value to 0: 2. Repeating the same code⁣   Always keep in mind the DRY rule. Don’t repeat yourself. The number of code lines will cost you in terms of app performance and loading time. 3. Using color names⁣   Using a color code is better: 4. Not using shorthand properties⁣   Avoid multiline of code when you can do the same thing with one line: 5. No font fallback⁣ Always complete the font you’re using:   Read More :: 5 Common Challenges Faced by Web Developers   Read More :: Top 10 Web Development Trends for 2021