More help with form please

J

Javascript N00bie

I have been working on this form, and have it exactly like I need it,
with one small exception. I need to append some text before and after
the text that is displayed in the TextArea.

For example:

Entering TESTING in the Info1 field displays TESTING in the Textarea,
which is perfect, except that I need it to display something like "you
are" TESTING "the Info1 Field".

The appended text does not need to be dynamic whatsoever.

Any help would be greatly appreciated.

My script is below:

<HTML>
<HEAD>
<TITLE>Test Page</TITLE>
<script type="text/javascript"><!--

if(document.all || document.getElementById){
styl='<style type="text/css">.drte{float:left;} .gche{float:left;}
..bas{clear:both;}</style>';
document.write(styl);
}

function see(){ // function for these submits (not to use)
ici=window.open('','target','width=400,height=300,scrollbars=1');
}

C = new Array();
R = new Array();

function chInit(ref){
if(R[ref] != ref) {
R[ref]=ref;
C[ref] = new Array();
}
}

function chAdd(myForm,myElemt,myResult,ref){

//(myResult)
if(myForm[myElemt].type!='text')
chArt(myForm,myElemt);
else
Article = myForm[myElemt].value;
ok=0;
for(i=0;i<C[ref].length;i++)
if(C[ref]==Article) ok=2;
(ok==1)?
alert(Article+' '+' Already Entered !')
:
C[ref][C[ref].length] = Article;
chMem(myForm,myResult,ref);
}



function chDel(myForm,myElemt,myResult,ref){
j=0;
if(myForm[myElemt].type!='text') {
chArt(myForm,myElemt);
for(i=0;i<C[ref].length;i++)
if(C[ref]==Article) j=i+1*1;
}
else
for(i=0;i<C[ref].length;i++)
if(C[ref]== myForm[myElemt].value)
j=i+1*1;
if(j!=0) {
for(i=j;i<C[ref].length;i++)
C[ref][i-1]=C[ref];
C[ref].length=(i-1*1);
}
chMem(myForm,myResult,ref);
}

function chMem(myForm,myResult,ref){
with(myForm[myResult]) {
value='';
for(i=0;i<C[ref].length;i++) {
value += C[ref];
if(i<(C[ref].length-1*1)) value += '\n';
}
}
}

function chReset(myForm,myResult,ref) {
C[ref] = new Array();
myForm[myResult].value=' ';
}


function highlightmetasearch() {
document.formname.text2copy.select();
document.formname.text2copy.focus();
}
function copymetasearch() {
highlightmetasearch();
textRange = document.formname.text2copy.createTextRange();
textRange.execCommand("RemoveFormat");
textRange.execCommand("Copy");
alert("This code has been copied to your clipboard.");
}


function copyText( obj ) {
if (obj.type=="text" || obj.type=="textarea"){
var rng = obj.createTextRange();
} else {
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
}

rng.scrollIntoView();
rng.select();

if (confirm('Copy the selected text to the ClipBoard?'))
rng.execCommand("Copy");
rng.collapse(false);
rng.select();

}
</SCRIPT>

</HEAD>
<BODY>
<HR>
<form id="Form1" action="0.htm" target="target"
onsubmit="alert(this['total1'].value);
see();
// return false;
">
<TABLE BORDER=0 >
<TR>
<TD>Info1 Here :</TD>
<TD>
<input type=text name="other1" id="other1" onchange="chInit(1);">
<input type=button onclick="chAdd(this.form,'other1','total1',1);"
value="Add">
<input type=button onclick="chDel(this.form,'other1','total1',1);"
value="Del"></TD>
<TD><I>Yadda Yadda Yadda</I></TD>
</TR>
<TR>
<TD>Info2 Here :
</TD>
<TD>
<input type=text name="other2" id="other2" onchange="chInit(1);">
<input type=button onclick="chAdd(this.form,'other2','total1',1);"
value="Add">
<input type=button onclick="chDel(this.form,'other2','total1',1);"
value="Del">
</TD>
<TD><I>Yadda Yadda Yadda</I></TD>
</TR>
</TR>
<TR>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>
<input type=button onclick="chAdd(this.form,'other1','total1',1),
chAdd(this.form,'other2','total1',1);" value="Add ALL">
<input type=button onclick="chReset(this.form,'total1',1);"
value="Delete All">
<input type=reset value="Reset"
onclick="chReset(this.form,'total1',1);">
</TD>
</TR>
</TABLE>
<HR>
<textarea name="total1" id="total1" rows=7, cols=55>
</textarea>
<input type=button onclick="javascript:copyText(document.all.total1);"
value="COPY"<br>
</form>
</html>
 

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,773
Messages
2,569,594
Members
45,121
Latest member
LowellMcGu
Top