Prev: FrontPage 2003 on windows 7 64 bit
Next: Open new page
From: 116 on 22 Jan 2010 09:45 I have aparticular form that every time I enter the form name in, that after closing the page and re-opening it, the name disappears. I even attempted to enter it directly into the page code. Still it disappears. Any thoughts? I believe this to be the issue to why I am having trouble running a proven jscript on this page. David
From: Jon Spivey on 22 Jan 2010 10:27 Without knowing what could be causing this it's usually easier not to name forms, rather pass the form to your function. Say you have some script that runs onsubmit <form onsubmit="return doForm(this);"> type frontpage here <input type="text" name="a" /> <input type="submit" /> </form> <script type="text/javascript"> function doForm(f){ if(f.a.value!='frontpage'){alert('type frontpage');return false;} return true; } </script> Apart from removing issues with form names scripts written this way are also much easier to re-use. Alternative is to reference by index, eg document.forms[0] <- 1st form on the page document.forms[1] <- 2nd form on the page etc With either of the above approaches the form doesn't need a name atall. Cheers, Jon http://MyMobileDeal.com "116" <116(a)discussions.microsoft.com> wrote in message news:CA673338-F86E-4858-B1AA-661CF04AA636(a)microsoft.com... >I have aparticular form that every time I enter the form name in, that >after > closing the page and re-opening it, the name disappears. I even attempted > to > enter it directly into the page code. Still it disappears. Any thoughts? > I > believe this to be the issue to why I am having trouble running a proven > jscript on this page. > > David
From: 116 on 22 Jan 2010 11:32 Thank you. This was the reason for my script not to work. The document.forms[#]. David "Jon Spivey" wrote: > Without knowing what could be causing this it's usually easier not to name > forms, rather pass the form to your function. Say you have some script that > runs onsubmit > > <form onsubmit="return doForm(this);"> > type frontpage here <input type="text" name="a" /> > <input type="submit" /> > </form> > > <script type="text/javascript"> > function doForm(f){ > if(f.a.value!='frontpage'){alert('type frontpage');return false;} > return true; > } > </script> > > Apart from removing issues with form names scripts written this way are also > much easier to re-use. Alternative is to reference by index, eg > document.forms[0] <- 1st form on the page > document.forms[1] <- 2nd form on the page > etc > > With either of the above approaches the form doesn't need a name atall. > > Cheers, > Jon > http://MyMobileDeal.com > > "116" <116(a)discussions.microsoft.com> wrote in message > news:CA673338-F86E-4858-B1AA-661CF04AA636(a)microsoft.com... > >I have aparticular form that every time I enter the form name in, that > >after > > closing the page and re-opening it, the name disappears. I even attempted > > to > > enter it directly into the page code. Still it disappears. Any thoughts? > > I > > believe this to be the issue to why I am having trouble running a proven > > jscript on this page. > > > > David > > > . >
|
Pages: 1 Prev: FrontPage 2003 on windows 7 64 bit Next: Open new page |