I ask you again about javascript.

Asked 2 years ago, Updated 2 years ago, 74 views

It is being developed as Django. When you click the button on the left, you want to print an application page on the right id=right. Script source now

<script>function button1()
{document.getElementById("right").innerHTML ="/apply"}
</script>
Is this the inner HTML part?

django javascript

2022-09-22 22:04

1 Answers

Why don't you change the structure?

Let's take an example of the Hashcode page you're looking at. If you look at the top, there's a navigation bar. The same type of navigation bar appears even if you press the [Ask] button, {#} on the far left of the navigation barYou can also press the image Hashcode.

But every time you click a link, you're not just re-drawing what's underneath the navigation bar with javascript, but you're drawing a new page that includes the same navigation bar every time.

[Asking a question] You can tell by the link on the button.

<attle="Ask questions" class="nav-link nav-question" data-placement="bottom" href="https://hashcode.co.kr/questions/new">Ask questions</a>

It leads to a page called https://hashcode.co.kr/questions/new where you draw the same navigation bar.

How about you organize the pages like this? Rather than changing the contents of the page with JavaScript, you create two pages that contain the same menu. And the navigation bar is used on both pages through template inheritance.

If you don't separate pages by function, it will be difficult to manage the controller (views.py's method) as well as template management in the warehouse.


2022-09-22 22:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.