Please tell me how to change only the image without moving the page I'm going crazy!

Asked 1 years ago, Updated 1 years ago, 115 views

I'm going to get the current ppt file from db, save it as one image file per slide, and call it one by one.

If you press the next button, the page will move and the picture will not change....

I tried to google it, but it didn't work, so I'm lostㅜㅠ/

The image file is imported into the resources folder, which is in the slide folder.

The file name is slide-1, slide-2, slide-3.

Below is the code.

<html>
<head>
<%
    int i = 1;
%>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script>
    $(document).ready(function() {
        $("pre").click(function() {
            <%i -= 1;%>
            $("#image").attr("src","resources/slide/slide-<%=i%>.JPG");
        });
    });


------------------------------------------------------------------------------------------------------------------------------------------------------

    <!-- Float ppt -->
    <DIV
        style="position: relative; top: 500px; left: 100px; width: 200; height: 200; background: white">

        <iframe width="520" height="415" id="image" name="NeBoard"
            src="resources/slide/slide-<%=i%>.JPG"  scrolling="No" onLoad="ResizeFrame('NeBoard');"></iframe>

        <FORM>
            <%
                if (i == 1) {
            %>
            <BUTTON id="pre" value='before' target="img" disabled="disabled">
                <img src="resources/img/pre.PNG" width="40" height="40">
            </BUTTON>
            <%
                } } else {
            %>
            <BUTTON id="pre" value="before" target="img">
                <img src="resources/img/pre.PNG" width="40" height="40">
            </BUTTON>
            <%
                }
            %>
            <BUTTON id="next" value="Next" target="img">
                <img src="resources/img/next.PNG" width="40" height="40">
            </BUTTON>
        </FORM>
    </DIV>
    <!-- Float ppt -->



</body>
</html>

html iframe jsp spring

2022-09-22 14:05

1 Answers

https://codepen.io/zuraizm/pen/vGDHl Please refer to the code.


2022-09-22 14:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.