Wednesday, 2024-12-25, 0:00 AM
Welcome Guest | RSS
Site menu
Tag Board
500
Our poll
Rate my site
Total of answers: 148
Statistics

Total online: 7
Guests: 7
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
 
«  December 2024  »
SuMoTuWeThFrSa
1234567
891011121314
15161718192021
22232425262728
293031

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