Help me reconstruct this code!

Discussion in 'JavaScript' started by shinan, Nov 25, 2008.

  1. #1
    This is an exercise given to girlfriend by her java tutor. She wrote down the code from the drawing board, and she thinks she missed something.. (since there is no output for this when she viewed this in html, in a browser)

    anyway, below is the code.
    can someone figure out whats missing/wrong here? and post the correct version of it please?


    <html>
    <head>
    <title> ternary
    </title>
    </head>
    <body>
    <script language=javascript>
    var a=50
    var b=10
    document.write("<pre>")
    x=(a>b)?>>a is greater>>:<<b is greater>>
    document.write("<br>"+"a"+"\t\t=\t"+a)
    document.write("<br>"+"b"+"\t\t=\t"+b)
    document.write("<hr>")
    document.write("<u>"+"javascript statment\n\n"+"</u>")
    document.write('x=(a>b>?"a is greater":b" is greater":b"greater"\n\n')
    document.write("<u>"+result\n"+"</u>")
    document.write("<br>"+"the value of x\t\t=\t"+x+"\n\n")
    y=(a>b)?true:false
    document.write("<u>"+"javascript statment\n\n"+"</u>")
    document.write('y=(a>b)?true:false\n\n')
    document.write("<u>"+"result\n"+"</u>")
    if(y==true)
    {
    document.write("<br>"+"value of 'y' is true\t-\ta ia greater")
    }
    else
    document.write("<br>"+"value of'y'is false \t-\tb is greater")
    }
    document.write("</pre>")
    </script>
    </hr>
    </body>
    </html>
    
    
    Code (markup):
    thanks.
     
    shinan, Nov 25, 2008 IP
  2. richie_rich$$$

    richie_rich$$$ Member

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    I'm to lazy to think right now :D
     
    richie_rich$$$, Nov 26, 2008 IP
  3. PresFox

    PresFox Active Member

    Messages:
    218
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    PresFox, Nov 26, 2008 IP
    shinan likes this.
  4. shinan

    shinan Well-Known Member

    Messages:
    1,826
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Thanks PresFox, She figured it out. I've added rep for you PresFox.


    - Thread is closed, Problem solved.
    :)
     
    shinan, Nov 28, 2008 IP