Home  >  Article  >  Web Front-end  >  Alternative to frameset in html5_html/css_WEB-ITnose

Alternative to frameset in html5_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:07:021036browse

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>

Just use innerHTML to change the content.

HTML code
5fca3ae8001961bc6ffb152b7b99a5e7abcd16b28748ea4df4d9c2150843fecfba68

3f1c4e4b6b16bbbd69b2ee476dc4f83a
function click_me(){
document.getElementById ('d').innerHTML='new text';
}
2cacc6d41bbb37262a98f745aa00fbf0
65de65e41c34e8f51f83535c1782cc4aclick65281c5ac262bf6d81768915a4a77ac0

...

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.

Statement:
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