Ok, this is some strange code. Why should you make it easy if you can obfuscate like this? ;-)
You defined an inner function Translate() inside the changetext() function, but you never call it.
You should think about the following:
- Why do you assign onclick event handlers in HTML as well as Javascript?
- What is the purpose of a table's <tbody> element inside a <form>?
- Why did you define the inner function Translate() in the first place?
For starters, you do this:
<input type="button" id="trans" onclick="changetext();" value="translate" />
but then you also do this:
document.getElementById("trans").onclick = function changetext()
Those are redundant.
One or the other, not both.
But in any case, you never actually *DO* anything in that onclick function.
You define the function Translate, but then you never invoke it.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
You give your buttons an onclick attribute, but also attempt to attach the same event with:
Code:
document.getElementById("trans").onclick = function changetext()
You should do one or the other.
In the above line of code your are naming the function. It is unusual to do this and (I am guessing) would not make this function available to call in your onclick="changetext()" attribute.
However, this function does not do anything. It contains a nested function Translate() which is never called.
Added: Both beat me!!
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
In the above line of code your are naming the function. It is unusual to do this and (I am guessing) would not make this function available to call in your onclick="changetext()" attribute.
You are correct. That function is still invisible to outside callers. So it is pointless to name it.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
You are correct. That function is still invisible to outside callers. So it is pointless to name it.
Thank you @Old Pedant. I recall that it can be useful, though, to show (named) in a stack trace ..?
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
I suppose so. Depends on how many levels deep you make your calls.
With Chrome, and with a reasonable number of calls, I don't have any trouble with "seeing" anonyomous functions. But yeah, what you say makes sense.
Yes, it was just a technical point that I recall. As you hint at, if the function calls are that deep then we would probably have other issues to worry about
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS