R N REDDY .Net Community - ASP
Sunday, 2016-12-04, 11:49 PM
Welcome Guest | RSS
Site menu
Tag Board
500
Our poll
How do you rate .Net classes ?
Total of answers: 194
Statistics

Total online: 1
Guests: 1
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
 
«  December 2016  »
SuMoTuWeThFrSa
    123
45678910
11121314151617
18192021222324
25262728293031

Twitter
 

Entries archive

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