Thursday, 2025-01-30, 6:42 PM
Welcome Guest | RSS
Site menu
Tag Board
500
Our poll
Which .Net class is more interset for you ?
Total of answers: 225
Statistics

Total online: 6
Guests: 6
Users: 0
22-12-2010

Java script will support various pre-defined objects.

Using each object we can access some of the pre-defined methods & properties.

Navigator Object: Navigator is a predefined java script object.

Navigator object is holding the complete information about the client web browser name and version.

It has 2 important properties:    1. App Name
                                                2. App Version

1. App Name: It is a navigator object property, it is representing client web browser name.
2. App Version: It is also a navigator object property, it is representing the client web browser version.

Eg: To identify client web browser name & version:
    <html>
        <head>
        </head>
        <body>
              <script type = "text/javascript">
              <var b_name = navigator.appName>
              <var b_version = navigator.appVersion>
              document.write("Your browser name is " +b_name +"<br>")
              document.write("Your browser version is " +b_version +"<br>")
              </script>
        </body>
    </html>
Output: Your browser name is Microsoft Internet Explorer
              Your browser version is 4.0(Compatible, MSIE 6.0; Windows NT 5.1; SV1; NET CLR 2.0.50727; NET CLR 3.0.45062152;)

In above output for browser version just I want to display the without fractional value for that we should update the above program like below.
    <html>
        <head>
        </head>
        <body>
              <script type = "text/javascript">
              <var b_name = navigator.appName>
              <var b_version = navigator.appVersion>
               var version = parseFloat(b_version)
               document.write("Your browser name is " +b_name +"<br>")
               document.write("Your browser version is " +version +"<br>")
               </script>
      </body>
    </html>
Output: Your browser name is Microsoft Internet Explorer
              Your browser version is 4

parseFloat: This method will remove the fractional part value from the given value.
Eg:    <html>
              <head>
              </head>
              <body>
                   <script type = "text/javascript">
                   <var b_name = navigator.appName>
                   <var b_version = navigator.appVersion>
                    var version = parseFloat(b_version)
                    if((b_name == "Microsoft Internet Explorer") || (b_name == "Netscape") && (version >= 4))       
                   {
                        alert("Your browser is Compatible")
                   }
                  Else
                 {
                       alert("Your browser is not Compatible")
                  }
                  </script>
           </body>
    </html>

String Object: It is a pre-defined java script object it will have various pre-defined methods & properties.

Length: Length prperty will return the no.of characters of given string.

toUpperCase(): This method will convert the string into upper case.

toLowerCase(): This method will convert the string into lower case.

Match(): Using this method we can search for a sub string within given string. If the sub string identified it will return null value.
  Using this method we can return the index value of sub string 1st character.
Search

Time
 

 

Calendar
 
«  January 2025  »
SuMoTuWeThFrSa
   1234
567891011
12131415161718
19202122232425
262728293031

Twitter
 

Entries archive

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