Saturday, 2024-11-16, 10:34 AM
Welcome Guest | RSS
Site menu
Tag Board
500
Our poll
How do you rate .Net classes ?
Total of answers: 208
Statistics

Total online: 4
Guests: 4
Users: 0
20-12-2010

Eg: for alert pop up box:
    <html>
       <head>
        <script type = "text/javascript">
              function myfun()
            {
             alert("virtual memory is low")
            }
        </script>
       </head>
       <body>
            <input type = "button" value = "Display" onclick = myfun()>
       </body>
    </html>
  Output: Virtual Memory is Low

Eg: for Confirm Box
    <html>
       <head>
        <script type = "text/javascript">
              function myfun()
            {
             confirm("Do you want to restart your computer")
            }
        </script>
       </head>
       <body>
            <input type = "button" value = "Display" onclick = myfun()>
       </body>
    </html>
Output:    Do you want to restart your computer

Eg: To pass a value to java script function:
    <html>
        <head>
        <script type = "text/javascript">
        function display(txt)
        {
          alert(txt)
        }
        </script>
      </head>
      <body>
        <input type = "button" value = "Morning" onclick = "display(Good Morning)">
        <input type = "button" value = "Evening" onclick = "display(Good Evening)">
      </body>
      </head>
    </html>

document.write():    It is a java script command, it will display the given value on web page.

Here, document is a pre-defined object & write is a pre-defined method.
Write method will print the given value on web page.

Eg: for returning a value from Java script function
    <html>
      <head>
        <script type = "text/javascript">
        function add(a,b)
        {
         return a+b
        }
        </script>
      </head>
      <body>
        <script type = "text/javascript">
        document.write(add(10,5))
        </script>
      </body>
    </html>
Output: 15
Search

Time
 

 

Calendar
 
«  November 2024  »
SuMoTuWeThFrSa
     12
3456789
10111213141516
17181920212223
24252627282930

Twitter
 

Entries archive

Copyright R N Reddy © 2024Developed by Nagendra, Venkat, Vijaya and Yaswanth
Get free updates as SMS to your mobile. Just register by clicking here