The missing button

I

inventor

I'm doing programming for my science prodject, and when I was
programming (I'm building an alphebatizer) I ran into this bug: I've
got an input box, but no button or output box. so I do some reaserch,
insert a button, and when I open it up, instead of the button being
added, I lost the input box. Can ANYONE PLEASE HELP ME!!!!!!!!!!!!!
I've included a copy of my code as it is:

<HTML>
<HEAD> Riehl's Alphebatizer
<SCRIPT LANGUAGE="JavaScript">
<!--beginning of JavaScript-
function alphebitize (inputText.value){
..split(" "); inputTextArray.sort(); result.join("
");result.send("outputText")
</HEAD>

<BODY> <document.bgcolor="blue">
type some words, separated by spaces, in here. to clear, click refresh.
<FORM>

<TEXTAREA name="inputText" rows=6 cols=85 wrap=on></TEXTAREA>
<INPUT NAME="submit" TYPE=Button VALUE="Alphebitize words"
onClick="alphebitize (form.inputText.value)")>

<TEXTAREA name="outputText" rows=6cols=85 wrap=on
readonly></TEXTAREA>

</FORM>

</BODY>
</HTML>


If you can help, please email me. My adress is : (e-mail address removed)
 
R

RobG

inventor said on 13/04/2006 8:55 AM AEST:
I'm doing programming for my science prodject, and when I was
programming (I'm building an alphebatizer) I ran into this bug: I've
got an input box, but no button or output box. so I do some reaserch,
insert a button, and when I open it up, instead of the button being
added, I lost the input box. Can ANYONE PLEASE HELP ME!!!!!!!!!!!!!
I've included a copy of my code as it is:

You need to start with valid HTML:

<HTML>
<HEAD> Riehl's Alphebatizer

Free text is not allowed in the head element. You might mean this to be
the content of a title element.

<title>Riehl's Alphebatizer</title>


You might want to spell that as "alphabetizer".

<SCRIPT LANGUAGE="JavaScript">

The language attribute is deprecated, type is required.

<!--beginning of JavaScript-

Don't use HTML comments inside script elements, use script comments. It
is to be expected that JavaScript will follow a script element
specifying that the content is JavaScript.

function alphebitize (inputText.value){
.split(" "); inputTextArray.sort(); result.join("
");result.send("outputText")

When posting code, format it for easy reading by others. It should work
as posted. Use new lines and 2 or 4 spaces for indenting, manually wrap
at about 70 characters to prevent auto-wrapping. Always include
semi-colons.

Formatting your code as I would expect a parser to read it I get:


function alphebitize (inputText.value)
{
.split(" ");
inputTextArray.sort();
result.join("");
result.send("outputText")

Comments:

1. In a function declaration, the identifier (here it's "alphebitize")
must be followed by a formal parameter list. Your use of something
that will be interpreted in some browsers as the value of a global
variable will cause an error. Likely it will have different results
in different browsers, but whatever the outcome it will not be what
I think you want.

2. Using a form name (inputText) as a global variable is not
standards compliant and not generally supported in browsers
other that IE (some do, and some will under certain circumstances).

3. split() is a method of a string object, you can't call it
on its own.

4. inputTextArray is not defined, if it was an array it would
have a sort method.

5. result is not defined, if it was an array it would have
a sort method

6. Guessing that you think result.join() converts 'result' to
a string, the built-in JavaScript string object does not
have a 'send' method (nor do array objects).

7. The code function is missing a closing brace '}'

8. The script element is missing a closing tag


Did you mean to write:

function alphabetize(textValue)
{
var inputTextArray = textValue.split(" ");
inputTextArray.sort();
var result = inputTextArray.join("");
return result;
}


Then the textarea onclick value should be like:

onclick="this.form.outputText.value=alphabetize(this.value);"


</HEAD>

<BODY> <document.bgcolor="blue">

You can't simply enclose a script statement in "<>" and expect it to be
executed. The affect of the above string on the document will be
dependent on how browsers deal with the various errors to this point.
Possibly it will be rendered as text, or not.

type some words, separated by spaces, in here. to clear, click refresh.
<FORM>

Form elements require an action attribute, even if it's empty.

<TEXTAREA name="inputText" rows=6 cols=85 wrap=on></TEXTAREA>

There is no 'wrap' attribute for textarea elements in HTML 4. Attribute
values should be quoted, even when not strictly required.

<INPUT NAME="submit" TYPE=Button VALUE="Alphebitize words"
onClick="alphebitize (form.inputText.value)")>

Giving a form control a name of 'submit' will affect the submit method
of the form in some browsers. There is usually no reason to give a
submit button (or any other button) a name.

[...]
 
I

inventor

gee, thanks! you were a big help! I called two people... neither of
them knew...anyway, thanks, hopefully it'll work now!

I made a few revisions before I got this: I got rie of the
"<document.bgcolor="blue">" thing.

Thanks again; you really helped me.
now... to find out if this works...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,816
Messages
2,569,706
Members
45,495
Latest member
cberns21

Latest Threads

Top