Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing additional elements to an existing form

Status
Not open for further replies.

rorr

Programmer
Dec 11, 2000
1
CA
I have a JavaScript program that is a shopping cart. I need to be able to write additional form elements to and existing form in a page in another frame. Is this possible? If so can someone point me in the direction as to how?
Any help would be appriciated.

Thaks Hobbes_78
 
You have to use DHTML.

Write <div> or <span> Tags in the form that should be changed by the JavaScript. e.g.:
<div name=&quot;Appl&quot; id=&quot;AP1&quot;></div>

In JavaScript write e.g.:
frame.document.all.AP1.outerHTML='<input name=&quot;test&quot; type=button>;'

The above example is IE only (because I use the all object).
 
thebigf : and also the outerHTML - i haven't seen it supported in netscrap but maybe i've got only old versions (ahahahah)

rorr : another way to do this is to actually put ALL the form elements, and to display only some. That way you can hide and show whatever field you want. It seems to the user that you add them but you only change the visibility
 
What browsers are you supporting? Netscape 6.0 has several methods for creating elements out of thin air that you can use. IE4+ has plenty also. If you need to support NS4-, use iza's approach jared@aauser.com
 
> I have a JavaScript program that is a shopping cart.

You are not doing a 'shopping cart' without some sort of Server Side processing ability are you?

If you are then that might be a better location for the logic you discribe.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top