Monday, December 12, 2011

JavaScript - 0002

Continued from:
http://schematron.blogspot.com/2011/11/javascript.html


Statements define what will the script do.
Statements in JavaScript are optional to end with semicolon, just a new line marks the beginning of a new statement.
Statements in JavaScript are mostly of following types.:

  • Conditional (if-then-else)
  • Comments (// ...) (/* ... */)
  • Object Manipulation
  • Loop (while-do)(for-)
  • Exception Handling

    Monday, November 28, 2011

    JavaScript - 0001

    Some of the text here is the learning from a superb and superior website  - http://www.tizag.com/javascriptT - for learning many languages and scripts.

    JS is a client side scripting language.
    The browser on the client's machine will run the script.
    It will help a web master to do more using the standard HTML and CSS.

    <html>

    <head/>

    <body>
    <script type="text/JavaScript">
    <!--
    document.write("how are you")
    //-->
    </script>
    </body>

    </html>

    • Make sure that the 'javascript' is enabled in your browser.
    • javascript - related functions can be put in the header, body or separate file (.js), as required.
    • <script src='jsfilename.js'/>
    • You may not need to write all the javascripts your self as pre written functions are available on website for free. Just download/copy to use and modify if required !
    • We do not necessarily use a semi colon if we write separate statements on separate lines. Use of semicolon (;) is mandatory if many js statements are written on the same line.

    Various functions, operators (arithmatic etc.) and variables are used:
    • var var1=5; var var2=12; var answ=var1+var2;
    • document.write(answer is = ); document.write(answ);
    • same variable can take as many values in a script as we want while we go on writing a script.
    • javascript variables cannot be reserved words, cannot start with numbers, good to use underscore and good to start with a lower case alphabets(a-z). 

    List and Types of operators are:
    • arithmetic... - * + / %
    • assignment... =
    • comparison... == != <= >= < >

    Functions in javascript is used by writing:
    • function funcname1() {put all the statements for functions in curly braces here}
    • we can use functions in functions.
    • functions are used by calling them with their name funcname1() where required.

    Events in javascript are one of the most exciting things:
    • javascript has a lot of predefined events and their names.


    ??? What are objects and methods in JavaScript.


    Continued to:
    http://schematron.blogspot.com/2011/12/javascript-0002.html

    Thursday, October 27, 2011

    assert or report

    which is a preferable way to test the xml "assert" or "report".


    e.g.


    <assert test="ns1:element1[@attrib1]">the attribute 'attrib1' of the element "element1" is missing</assert>




    OR


    <report test="ns1:element1[not(@attrib1)]">the attribute 'attrib1' of the element "element1" is missing</report>