通过html页面滑动下一个和上一个按钮

时间:2021-11-13 23:12:58

I am creating multi page form on 4 different pages. I want to include a next and previous button to be able to navigate through the form. I have searched online but what i find is usually navigating <div>s on a page. How do I change this to do my bidding? Thank you in advance.

我在4个不同的页面上创建多页面表单。我想要包含下一个和上一个按钮,以便能够浏览表单。我在线搜索但我发现通常是在页面上导航

s。如何更改此选项以进行出价?先感谢您。

this is the code for the previous button i found online. .registration-form is the name of a form. I want to change this to navigate through my html pages.

这是我在网上找到的上一个按钮的代码。 .registration-form是表单的名称。我想改变它来浏览我的html页面。

$('.registration-form .btn-previous').on('click', function() {
    $(this).parents('fieldset').fadeOut(400, function() {
        $(this).prev().fadeIn();
    });
});

Forms on the different pages have names part1, part2, part3 and part4. Also when a user goes to a previous page and goes back the next page, the user should see what he/she entered before pressing the previous button.

不同页面上的表单具有名称part1,part2,part3和part4。此外,当用户前往上一页并返回下一页时,用户应该在按下前一个按钮之前看到他/她输入的内容。

2 个解决方案

#1


0  

A static solution for you is that you can set next previous button to every page and set the respective links on that pages

一个静态的解决方案是,您可以为每个页面设置下一个上一个按钮,并在该页面上设置相应的链接

for eg.

page1.html

<input type="button" value="Previous" onclick="window.location='page4.html'">
<input type="button" value="Next" onclick="window.location='page2.html'">

page2.html

<input type="button" value="Previous" onclick="window.location='page1.html'">
<input type="button" value="Next" onclick="window.location='page3.html'">

page3.html

<input type="button" value="Previous" onclick="window.location='page2.html'">
<input type="button" value="Next" onclick="window.location='page4.html'">

page4.html

<input type="button" value="Previous" onclick="window.location='page3.html'">
<input type="button" value="Next" onclick="window.location='page1.html'">

#2


0  

You could create a button in html that links to a different page.

您可以在html中创建一个链接到不同页面的按钮。

<input type="button" onclick="location.href='http://google.com';" value="Go to Google" />

#1


0  

A static solution for you is that you can set next previous button to every page and set the respective links on that pages

一个静态的解决方案是,您可以为每个页面设置下一个上一个按钮,并在该页面上设置相应的链接

for eg.

page1.html

<input type="button" value="Previous" onclick="window.location='page4.html'">
<input type="button" value="Next" onclick="window.location='page2.html'">

page2.html

<input type="button" value="Previous" onclick="window.location='page1.html'">
<input type="button" value="Next" onclick="window.location='page3.html'">

page3.html

<input type="button" value="Previous" onclick="window.location='page2.html'">
<input type="button" value="Next" onclick="window.location='page4.html'">

page4.html

<input type="button" value="Previous" onclick="window.location='page3.html'">
<input type="button" value="Next" onclick="window.location='page1.html'">

#2


0  

You could create a button in html that links to a different page.

您可以在html中创建一个链接到不同页面的按钮。

<input type="button" onclick="location.href='http://google.com';" value="Go to Google" />