There is an (ASP/VBS) form that has 3 dropdown lists. Most of the code is actually JS, either hard coded or created by the VBS. The form works fine, does exactly what it should do. /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
Now I need to 're-use' all the (JS) code in various ASP pages, which is easily done by the use of "includes". However, one problem; the original form (that works) had a form name, by the use of ID and NAME atrributes. The form was called 'FrmInfo", and therefore JS code used when the form loads, like:
frm = document.getElementById('frmInfo');
worked okay, and also any reference to the form like:
frm.selType.options[frm.selType.options.length] = new Option('--Select--', 'Sel');
//using other JS function to re-populate other dropdowns
but the problem I'm facing is that now, wanting to re-use the JS code in a number of ASP pages, using the JS code in an "include" references an actual form name (in this example the form name is 'FrmInfo' ).
The ASP pages that need the JS code have forms with no names. /sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
There are two ways to address this (probably more ??):
1. If I give the ASP pages form names, how do I pass the form name to the JS code, or more to the point, how can the JS code, go from:
Well, ....... you get what I mean, I hope. /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
2. The second method is to leave the ASP pages with no form names (preferred method, because it will reduce maintenance when the ASP 'product' has new releases). I have seen code like:
Is that how to reference fields and values in a form that has no name ??