Alternative to frameset in html5_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:07:02
Original
1035 people have browsed it

Because we want to make a pad version of the web application, we need to avoid using frames to implement the page frame. According to the description of HTML5, it can be implemented with div css. But the problem is how to solve the partial refresh (refresh a certain frame)? If the div css is used and the content needs to be refreshed every time an event is triggered on the page, the entire page will be refreshed... This is definitely not possible! ! !

Please give me advice~~~~~~~~~


Reply to the discussion (solution)

Use innerHTML to change the content as you like That's it.

<div id="d">abcd</div><script>function click_me(){   document.getElementById('d').innerHTML='new text';}</script><button onclick="click_me()">click</button>
Copy after login

Just use innerHTML to change the content.

HTML code

abcd


<script> <br> function click_me(){ <br> document.getElementById ('d').innerHTML='new text'; <br> } <br> </script>


...

This is not a matter of modifying one or two attributes. The interface feels like switching the entire page of a certain section

jquery's
$("#divID" ).load("xx.htm") page

Use jq's load method
http://api.jquery.com/load/

This is not a modification The problem with the two attributes is that the interface feels like switching the entire page of a certain section

Looking at the essence through the phenomenon, no matter what the jquery load method is,
in this case, innerHTML is used Do replacement of internal elements.

You can replace any number of elements with innerHTML.

jquery’s
$("#divID").load("xx.htm") page is enough

Let’s take a look at the master’s event

Uh, an old post from 2012~

Two processes:
1. Obtain document fragments or data from the server (the document fragments or data will have a data format, such as json, xml). You can use the XmlHTTPRequest object to get it in ajax mode, you can also get it in a concise way through frameworks such as jquery, or you can get it through webSocket.
2. Parse the document fragments fetched from the server into DOM fragments according to the agreed data format, and then append them to a node on the page. There will be JSON and XML objects in the browser environment, and their APIs have the parse() method, which can be parsed. However, there will be many redundant nodes, so regular expressions can be used to parse, which requires regular expressions. You need to write well, but I guess you are not proficient in asking this kind of question. Then you can find relevant js frameworks to complete the parsing process. I will not advertise these frameworks, not too many.
3. If this part of the DOM fragment needs to be bound to an event, it needs to be bound again. If step 2 is "replace" instead of append, the event is still there and there is no need to bind the event again.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!