Member Avatar
HTMLperson5

Whats wrong with this code?
I have not any errors from ie.

<html>
<script type="text/javascript">
var a = 1;
var b = 2;
if (a < b) {
    document.write("CONDITION TRUE :D")
} else {
    document.write("CONDITION IS FALSE D:")



</script>

So?

Your else branch is missing a closing }.

As a tip for the future: Many browsers have some sort of Javascript console, which lists any errors that were encountered while trying to execute the Javascript on the current page. Looking at the messages in that console will help you find errors like this quickly.

Member Avatar
HTMLperson5

Many browsers have some sort of Javascript console

Where can I find that console?
I use Mozilla Firefox btw.

In Firefox it's in the menu under Tools -> Web Developer -> Web Console (shortcut: Ctrl + Shift + K).

IE9 also has some built in developer tools...hit F12. I do prefer Firefox tools though.

You can also just right click and hit "Inspect Element" then click on console when it pops up.
This only works for firefox, chrome, and safari, I'm not sure about IE, but there's just a different method of getting to the console in IE.

Member Avatar
HTMLperson5

This only works for firefox, chrome, and safari,

Not true, not for firefox any way - only for Chrome though.

Hmmm, really? Are you using a current version of firefox?

Member Avatar
HTMLperson5

Are you using a current version of firefox?

Yes, yes I am. I am running version 9.0.1.

Hmmmm, I'm not using Firefox right now, but if I remember correctly, Firefox should let you inspect element. I even remember a cool little popout 3D code thing with Firefox...

Member Avatar
HTMLperson5

if I remember correctly, Firefox should let you inspect element

No, it does not. When I right click on any page I have options:

"Back"
"Forward"
"Reload Page"
"Stop"
"Bookmark this page"
"Save page as..."
"Send link"
"View Background Image"
"Select All"
"View Page Source"
"View Page info"

No inspect element :(

Open a chrome browser and press Ctrl+Shift+I.
Then go to console tab and paste your code and hit enter, that should do it.

Member Avatar
HTMLperson5

Open a chrome browser and press Ctrl+Shift+I.

I don't have Chrome, though.
Web Developer Console is good enough for me...
However, sometimes it gives wierd, undetailed errors, for instance: "too much recursion"

It workcs for firefox, you just need to install a firebug, it's an addon. A developer should always have chrome, firefox and ie :)