I was wondering if anyone could clear up the technique of passing parameters for me. I have read many books on C, C++, JavaScript, CGI/Perl and still do not understand how this is done. I must be thick. For example...here is a tiny JavaScript code...
<HTML>
<TITLE> A text Area Example</TITLE>
<BODY>
<CENTER>
<FORM>
<TEXTAREA NAME="Textarea" COLS=30 ROWS=10></TEXTAREA>
<BR>
<BR>
<INPUT TYPE=BUTTON Value="Display Message" onClick="DisplayMessage(this.form)">
</FORM>
</CENTER>
</BODY>
<SCRIPT LANGUAGE=JavaScript>
function DisplayMessage(form1)
{
form1.Textarea.value="Hello World"
}
</SCRIPT>
</HTML>
OK...when the user clicks on the button, this calls the function DisplayMessage(???)
What the (this.form) does, I have a general idea but not specific. I think it saying that the "this" is saying that the DisplayMessage function should
display something in particular. Something indicated in between the <FORM> and the </FORM> tags of THIS section of code, versus say, ANOTHER section of code.
OK...this is just a CALL a function.
When we get to the actual function, (I think it is just now being declared). But what is the form1 argument for? I have already been told what to display in the onClick line. Why is it in two places. There is nothing else in the code called "form1".
Why can't it be done like this so people could understand it?
<HTML>
<TITLE> A text Area Example</TITLE>
<BODY>
<CENTER>
<FORM 1>
<TEXTAREA NAME="Textarea" COLS=30 ROWS=10></TEXTAREA>
<BR>
<BR>
<INPUT TYPE=BUTTON Value="Display Message" onClick="DisplayMessage()">
</FORM 1>
</CENTER>
</BODY>
<SCRIPT LANGUAGE=JavaScript>
function DisplayMessage()
{
"Hello World"
}
</SCRIPT>
</HTML>
Now I can see whats going on. The user clicks the button and calls DisplayMessage(). The computer now searches out DisplayMessage() and sees the text to display in the brackets { }. Why are they going thru all this passing stuff. I don't even know who it is being passed to.
Thanks for looking at this.
Rocky Shepheard
<HTML>
<TITLE> A text Area Example</TITLE>
<BODY>
<CENTER>
<FORM>
<TEXTAREA NAME="Textarea" COLS=30 ROWS=10></TEXTAREA>
<BR>
<BR>
<INPUT TYPE=BUTTON Value="Display Message" onClick="DisplayMessage(this.form)">
</FORM>
</CENTER>
</BODY>
<SCRIPT LANGUAGE=JavaScript>
function DisplayMessage(form1)
{
form1.Textarea.value="Hello World"
}
</SCRIPT>
</HTML>
OK...when the user clicks on the button, this calls the function DisplayMessage(???)
What the (this.form) does, I have a general idea but not specific. I think it saying that the "this" is saying that the DisplayMessage function should
display something in particular. Something indicated in between the <FORM> and the </FORM> tags of THIS section of code, versus say, ANOTHER section of code.
OK...this is just a CALL a function.
When we get to the actual function, (I think it is just now being declared). But what is the form1 argument for? I have already been told what to display in the onClick line. Why is it in two places. There is nothing else in the code called "form1".
Why can't it be done like this so people could understand it?
<HTML>
<TITLE> A text Area Example</TITLE>
<BODY>
<CENTER>
<FORM 1>
<TEXTAREA NAME="Textarea" COLS=30 ROWS=10></TEXTAREA>
<BR>
<BR>
<INPUT TYPE=BUTTON Value="Display Message" onClick="DisplayMessage()">
</FORM 1>
</CENTER>
</BODY>
<SCRIPT LANGUAGE=JavaScript>
function DisplayMessage()
{
"Hello World"
}
</SCRIPT>
</HTML>
Now I can see whats going on. The user clicks the button and calls DisplayMessage(). The computer now searches out DisplayMessage() and sees the text to display in the brackets { }. Why are they going thru all this passing stuff. I don't even know who it is being passed to.
Thanks for looking at this.
Rocky Shepheard