Reputation: 123
I have two html pages.
I enter to the first page, press the button and go to the second page. The problem is that when Im in the second page (signin.html) and I press the back button from the browser I dont go to the first page (welcome.html) I go to some other previous page. I need to be able to go back by pressing that button, how can I achive that?
html 1 welcome.html
<HTML>
<HEAD>
<TITLE>
Welcome page
</TITLE>
</HEAD>
<BODY>
<div>
<div class="button">
<input name="account" type="button" value="I am a service provider" onclick="window.location.replace('/member/sign-in.html')"/>
</div>
</BODY>
</HTML>
html 2 signin.html
<HTML>
<HEAD>
<TITLE>
Member sign in
</TITLE>
</HEAD>
<BODY>
<form id="myform" action="/my-code/signInMember.php" method="post">
<div>
<label for="spEmail">E-mail:</label>
<input type="email" id="spEmail" name="spEmail" required/>
</div>
<div>
<label for="spPswd">Password:</label>
<input type="password" id="spPswd" name="spPswd" required/>
</div>
<div class="button">
<button type="submit" name="submit">Sign in</button>
</div>
<div class="button">
<input name="submit" type="button" value="sign up for free" onclick="window.location.replace('/member/create-account.html')"/>
</div>
<div/>
</form>
</BODY>
</HTML>
Any ideas? I was looking around and everybody say to add a button to go back (with php or javascript) but I dont want that. I want to press the browser button and then go back, no with a button in the page itself.
Thanks, any help will be appreciated.
Upvotes: 0
Views: 144
Reputation: 123
thanks, I changed as suggested:
<form>
<input TYPE="button" VALUE="Offer this service"
onclick="window.location.href='/member/signin.html'">
</form>
And it worked!
Upvotes: 1
Reputation: 492
onclick event rather than using "window.location.replace('/member/sign-in.html')"
use "window.location.href='/member/sign-in.html'"
or "window.location.href='member/sign-in.html'"
according to your path of destination html.
Upvotes: 2