• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

code to switch english to french and french to english

 
Tesla Doty
Greenhorn
Posts: 10
Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Javascript and have this code to switch english to french and french to english. I have seen other posts on this same coding assignment and have tried to implement the answers from those problems into my code as well as what we went over in the chapter. Everything seems fine when I look at the code but the page isn't working as I intended so I know there is a problem. This is my first javascript assignment and I'm having a very difficult time locating my error. I appreciate any help in advance! I do not just want someone to code this for me, I want to understand where my error is. Here is the javascript code:




 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34198
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tesla Doty wrote:Everything seems fine when I look at the code but the page isn't working as I intended so I know there is a problem.

Can you elaborate on what "not working" means? Is there an error in the JavaScript console. Does it do anything?
 
Tesla Doty
Greenhorn
Posts: 10
Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:
Tesla Doty wrote:Everything seems fine when I look at the code but the page isn't working as I intended so I know there is a problem.

Can you elaborate on what "not working" means? Is there an error in the JavaScript console. Does it do anything?


When I load the page there are English phrases. When you click the phrase it is supposed to show the english phrase, and on mouse up revert back. My apologies for not being as descriptive as I should be. Still getting the hang of wording forum questions right.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open the JavaScript console. Are there any erros when you try to do things?

If not, set breakpoints and see what the code is doing.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Open the JavaScript console. Are there any erros when you try to do things?

If not, set breakpoints and see what the code is doing.


I think you might be assuming too much here, Bear.
 
Tesla Doty
Greenhorn
Posts: 10
Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing this for my html class. We have not got into setting breakpoints, debugging, or using the console. We have only just covered tidbits of javascript within web pages in tutorials. I feel like a total noob for not understanding this. The class just throws code at us and doesn't explain much about actually working with the code.
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I was tasked with writing an introduction to JavaScript in as few pages as possible I started with how to access the developer console, seemed the quickest way to get going.

Tesla, if you're using IE or Chrome: hit F12. If you're using Firefox: hold down Ctrl+Shift and then hit K. Look for where it says 'Console' and select that tab if it's not already selected. Are there any error messages (they'll likely be coloured red or orange)?

For starters, I would investigate this line:


It looks like you're trying to attach a file to the onload event handler. This won't work, the thing on the right of the = needs to be a function. I suspect it's supposed to be:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Crowther wrote:When I was tasked with writing an introduction to JavaScript in as few pages as possible I started with how to access the developer console, seemed the quickest way to get going.


100% agree.

Learning how to use the console as a tool is one of the very first things to learn. Otherwise, you're flying blind. It's like trying to fight a training droid with the blast shield down -- unless you program using The Force.

 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we expect "jQuery Jedi Masters" to follow "Secrets of the JavaScript Ninja"? ;)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jedi Master === Ninja in Space!

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Although Secrets of the jQuery Jedi has a certain ring to it, I'm not sure I'd want to pay Lucas-level royalties!)
 
Tesla Doty
Greenhorn
Posts: 10
Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Crowther wrote:When I was tasked with writing an introduction to JavaScript in as few pages as possible I started with how to access the developer console, seemed the quickest way to get going.

Tesla, if you're using IE or Chrome: hit F12. If you're using Firefox: hold down Ctrl+Shift and then hit K. Look for where it says 'Console' and select that tab if it's not already selected. Are there any error messages (they'll likely be coloured red or orange)?

For starters, I would investigate this line:


It looks like you're trying to attach a file to the onload event handler. This won't work, the thing on the right of the = needs to be a function. I suspect it's supposed to be:


Thank you so much for your help! Now I'll be able to figure out where my problems are. I can't believe they didn't tell us about that in class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic