SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: Object & Code Handling
-
May 29, 2002, 12:42 #1
- Join Date
- Feb 2002
- Location
- California, USA
- Posts
- 27
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Object & Code Handling
Good Day All,
in perusing a recent discovery, http://javascript.internet.com, I came across a script for an adlib which I have modified to generate correspondence on an intranet page. The code takes the input of a few key boxes and places the inputted text within the appropriate sections of a paragraph, which is generated in another instance of the web-browser.
I'd like to modify this code to make the text fall into a text input box as opposed to a new instance of the browser. The code for the adlib script is at http://javascript.internet.com/misce...ar.html#source
Any help you can provide would be greatly appreciated!
Warmest Regards,
Drk.
-
May 30, 2002, 01:32 #2
Hi,
This should work for ya' ... just not positive which browsers will support it, cuz I'm on my WebTv, I'm running back-ups on my PC & can't get on it to test.
This modified script does work on WebTv & I'm pretty sure it will work across the board, if not, let me know.
Basically, I removed the popup window crap, so now, after establishing a value for "text" variable, it will write that to the form field that's specified. I added comment tags, so you can edit as needed.
Here is the test page:
http://www.wtv-zone.com/lillad/temp/...orm-field.html
Code:<script type="Text/Javascrit" Language="JavaScript"> /* Modified By Little Guy This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com */ <!-- Begin function create(form){ var start="go"; if (start=="go") { alert('Here we go...'); text = ("<HEAD><TITLE>Mark Anthony's Address from 'Julius Caesar' </TITLE> </HEAD>"); text += ("<BODY BGCOLOR = '#FFFFFF'><CENTER><B><FONT FACE = 'Arial' SIZE = 4>"); text += ("Mark Anthony's Address from<BR> 'Julius Caesar' </FONT></B></CENTER><BR>"); text += ("Friends, Romans, " +form.input1.value+ " lend me your " +form.input2.value+ "; "); text += ("I come to " +form.input3.value+ " Caesar, not to praise him. "); text += ("The evil that men do lives after them, the good is oft interred with their " +form.input4.value+ "; "); text += ("so let it be with " +form.input5.value+ ". " ); text += ("The noble Brutus hath told you Caesar was " +form.input6.value+ "; if it were so, it was a grievous fault. "); text += ("If you have " +form.input7.value+ ", prepare to shed them now. "); text += ("You all do know this " +form.input8.value+ ". "); text += ("I remember the first time Caesar put it on. "); text += ("Through this well-beloved Brutus stabbed; for Brutus, as you know, was Caesar's " +form.input9.value+ ": "); text += ("this was the unkindest " +form.input10.value+ " of all. "); text += ("Here is the " +form.input11.value+ ", under Caesar's seal. To every Roman " +form.input12.value+ " he gives, "); text += ("to every several man, seventy five " +form.input13.value+ ". "); text += ("Here was a/an " +form.input14.value+ "! When comes another?"); // Now pass the value to the <form> field below document.little.guy.value = text; } } // End --> </SCRIPT> <!-- STEP TWO: Put this code into the BODY of your HTML document --> <BODY> <CENTER> Fill in the form, and then press the button for your own Julius Caesar Madlib.<BR><BR> <BLOCKQUOTE> <FORM> <TABLE BORDER = 0 CELLPADDING = 2> <TR><TD> Plural Noun:<TD><INPUT TYPE="text" NAME="input1" SIZE=20><BR> <TR><TD> Part of body (plural):<TD><INPUT TYPE="text" NAME="input2" SIZE=20 ><BR> <TR><TD> Verb:<TD><INPUT TYPE="text" NAME="input3" SIZE=20 ><BR> <TR><TD> Name:<TD><INPUT TYPE="text" NAME="input4" SIZE=20 ><BR> <TR><TD> Name of Polictician:<TD><INPUT TYPE="text" NAME="input5" SIZE=20 ><BR> <TR><TD> Adjective:<TD><INPUT TYPE="text" NAME="input6" SIZE=20 ><BR> <TR><TD> Article of Clothing:<TD><INPUT TYPE="text" NAME="input7" SIZE=20 ><BR> <TR><TD> Article of Clothing:<TD><INPUT TYPE="text" NAME="input8" SIZE=20 ><BR> <TR><TD> Occupation:<TD><INPUT TYPE="text" NAME="input9" SIZE=20 ><BR> <TR><TD> Noun:<TD><INPUT TYPE="text" NAME="input10" SIZE=20 ><BR> <TR><TD> Noun:<TD><INPUT TYPE="text" NAME="input11" SIZE=20 ><BR> <TR><TD>Noun:<TD><INPUT TYPE="text" NAME="input12" SIZE=20 ><BR> <TR><TD>Animal (plural):<TD><INPUT TYPE="text" NAME="input13" SIZE=20 ><BR> <TR><TD>A Food:<TD><INPUT TYPE="text" NAME="input14" SIZE=20 ><BR></TABLE> <BR><BR> <INPUT TYPE="button" VALUE="Send To TextArea" ONCLICK="create(this.form)"> </CENTER></FORM></BLOCKQUOTE></CENTER> <br><br> <!-- Added Textarea To Write To --> <center> <form name="little"> <textarea name="guy" rows="4" cols="50"></textarea> </form> </center>
-
May 30, 2002, 14:49 #3
LoL, I guess it's not supported by other browsers. I'm on my PC & the script won't fire for me (IE6) Sorry 'bout that.....I just made the switch to a PC, so I'm having to learn new methods....
I'll mess with it on here & see what I come up with.
L8tr,
LittleMan
-
May 30, 2002, 16:02 #4
Hey....
This one has me frazzled
LoL, I just tried a few other scripts I have using that same basic method & they work for me, so I'm not sure what's up w/ this one.
Here is a page that I made for WebTv that writes to a textarea using a little different method, & it works for me on IE6. I'll try your script using this method, see if it works.
http://www.wtv-zone.com/lillad/1/buildacard.html
I'll get it sooner or later, LoL
-
Jun 3, 2002, 09:50 #5
- Join Date
- Feb 2002
- Location
- California, USA
- Posts
- 27
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for looking into this, it certainly has me stumped, although i'm not suprised at that, I'm relatively new at all this.
Still awaiting an answer on this, it (has) to be possible, eh?!
-
Jun 3, 2002, 20:58 #6
Hey, No problem.
I've checked some of the scripts I have, that do work on my PC, & I'm pretty sure the one I posted should work also, I just can't seem to figure out why it doesn't.
Maybe someone w/ more knowledge of using scripts on a PC can help.
I'm guessing it's just a simple syntax error, since that method works in other scripts.
Sorry I wasn't more help....
LittleMan
Bookmarks