0

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?

Edited by HTMLperson5

5
Contributors
14
Replies
15
Views
5 Years
Discussion Span
Last Post by lambing
0

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.

0

Many browsers have some sort of Javascript console

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

0

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

0

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

Edited by JorgeM

0

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.

0

This only works for firefox, chrome, and safari,

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

Edited by HTMLperson5: Made spelling mistake

0

Are you using a current version of firefox?

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

0

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...

0

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 :(

0

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.

0

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"

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.