Prev: How to get the html elements of Iframe from the Parent page by javascript
Next: jQuery vs. My Library
From: JR on 22 Jan 2010 17:13 On Jan 22, 10:57 am, Diddum <g.re...(a)iit.cnr.it> wrote: > Hello everybody. > Until now I've only needed some php for my simple web pages, but now > I think I may need to learn javascript. Before that, I would like to > know > if the following behaviour can be obtained by means of some javascript > code > > Simplifying... I have a web page (say mymain.php) in php/html with a > html form, > with just a text field and a button. Something like this: > > <form method="POST" action="foobar.php" > > <input type="text" name="footxt" SIZE="8"> > <input type="submit" value="gogogo"> > </form> > > This is the scenario that I want to change: > The user lands on this page (mymain.php), then put something in the > text field, > then clicks on the button, invoking the action page foobar.php. > Then usually the user go back (with "back" on the browser) to > mymain.php, > change the field, click the button, and so invokes again foobar.php. > And so on. > In practice, the page mymain.php is loaded once (then lies in the > browser memory) > while foobar.php is loaded with POST parameters each time the user > clicks the button. > > What I want to obtain: > When the user clicks on the button, instead of loading always > foobar.php, > I want that the form invokes randomly, say, fub1.php and fub2.php. > > Clearly, using server side php, I can modify easily mymain.php in such > a way that > more or less half of the users load a form with action="fub1.php" and > the > others load a page with action="fub2.php". But in this way, once > mymain.php > has been loaded, each user, going back and forth, will load always > fub1.php > or always fub2.php. > Instead I want that the same form, in some way, would lead sometimes > to fub1.php and sometimes to fub2.php. > Like, magically, the click on the button could randomly rewrite the > action target of the > form.... > > I apologize for this long message, but while the problem is simple, I > had some > difficulties in explaining it clearly. Have you tried using headers (Expires and Cache-Control) instead of Javascript? -- JR
First
|
Prev
|
Pages: 1 2 3 4 Prev: How to get the html elements of Iframe from the Parent page by javascript Next: jQuery vs. My Library |