Results 1 to 6 of 6
Related
-
form input changes textarea output Forum: Javascript Forum
Replies: 1 -
using javascript to update checkbox values and write output to textarea dynamically Forum: Javascript Forum
Replies: 6 -
help me to write code for "remove textarea" button Forum: Javascript Forum
Replies: 1 -
Help W/ interactive user input form Forum: Javascript Forum
Replies: 1 -
CGI form input doesn't write to text file Forum: CGI Perl Forum
Replies: 2
-
01-02-2004, 12:05 AM #1
trying to write to textarea based on user input
hello,
I am trying to write to multiple textarea boxes
we have multiple banners and would like to include the link code in a textarea box below each banner.
each affiliate has a unique code that is in the middle of the link.
there is an input at the top of the page that asks for the users affiliate code. untill they enter the code the textarea shows xxxxx in place of the numbers.
everything works fine for the first banner, but the second doesnt update with the affiliate code.
any suggestions?
here is the function and form:
Code:<head> <SCRIPT LANGUAGE=javascript> <!-- function GenerateLink(){ document.getElementById("textarea1").value="<A href='http://refer.website.com/cgi-bin/clicks.cgi?id=" + document.getElementById("affiliateId").value +"&HTML=home.html'><IMG src='http://www.website.com/banners/banner1.gif' height=60 width=468 border=0></A>"; document.textarea1.style="display:block"; document.getElementById("textarea2").value="<A href='http://refer.website.com/cgi-bin/clicks.cgi?id=" + document.getElementById("affiliateId").value +"&HTML=home.html'><IMG src='http://www.website.com/banners/banner2.gif' height=60 width=468 border=0></A>"; document.textarea2.style="display:block"; } //--> </SCRIPT> </head> <body> <pre> <form name=userform> Affiliatel ID: <input type=text name="affiliateId" size=8 value="" > <Br> <input type=button name=action value="Submit" onClick="GenerateLink()"> </form> </pre> <p> <img src="http://www.website.com/banners/banner1.gif"> <textarea NAME="textarea" ROWS=5 COLS=50 WRAP=VIRTUAL id=textarea1> <a href="http://refer.website.com/cgi-bin/clicks.cgi?id=XXXXXX&HTML=home.html"><img src="http://www.website.com/banners/banner1.gif" width=468 height=60 border=0></a> </textarea> <img src="http://www.website.com/banners/banner2.gif"> <textarea NAME="textarea" ROWS=5 COLS=50 WRAP=VIRTUAL id=textarea1> <a href="http://refer.website.com/cgi-bin/clicks.cgi?id=XXXXXX&HTML=home.html"><img src="http://www.website.com/banners/banner2.gif" width=468 height=60 border=0></a> </textarea> </body>
Last edited by HTML; 01-05-2004 at 09:13 PM.
-
01-02-2004, 12:12 AM #2
error in what is shown...
above the second textarea id is shown as id=textarea1 (which is the same as the first)
it should be textarea2... i just got frustrated and started trying different things to see if anything changed. but even as textarea2 the problems the same.
-
01-02-2004, 02:15 AM #3
First of all, your textareas should be within the <FORM> tags.
-
01-02-2004, 11:57 AM #4
No luck
I wouldnt think that the form tag would matter since the textareas are being used for output not input. But I'm no expert so I moved the tag down and closed the form after both textareas and gave it another try with no luck.
-
01-02-2004, 12:46 PM #5
enigma is correct.
Try this simplified version -
Code:<head> <SCRIPT LANGUAGE="javascript"> <!-- function GenerateLink(formObj){ formObj.link1.value="<A href='http://refer.website.com/cgi-bin/clicks.cgi?id=" + formObj.affiliateId.value +"&HTML=home.html'><IMG src='http://www.website.com/banners/banner1.gif' height=60 width=468 border=0></A>"; formObj.link2.value="<A href='http://refer.website.com/cgi-bin/clicks.cgi?id=" + formObj.affiliateId.value +"&HTML=home.html'><IMG src='http://www.website.com/banners/banner2.gif' height=60 width=468 border=0></A>"; } //--> </SCRIPT> </head> <body> <pre> <form name="userform"> Affiliatel ID: <input type=text name="affiliateId" size=8 value="" > <Br> <input type=button name=action value="Submit" onClick="GenerateLink(this.form);"> </pre> <p> <img src="http://www.website.com/banners/banner1.gif"> <textarea NAME="link1" ROWS=5 COLS=50 WRAP=VIRTUAL id="link1"> </textarea> <img src="http://www.website.com/banners/banner2.gif"> <textarea NAME="link2" ROWS=5 COLS=50 WRAP=VIRTUAL id="link2"> </textarea> </form> </body>
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
01-02-2004, 02:49 PM #6
That was it!
Thanks, everythings working great now...
difinately appreciate your help!
Greg
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum