Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write php adaptive web page code

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the php adaptive web page code how to write the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this php adaptive web page code how to write the article will have a harvest, let's take a look.

I. Program code

Function SetWinHeight (obj)

{

Var win=obj

If (document.getElementById)

{

If (win & &! window.opera)

{

If (win.contentDocument & & win.contentDocument.body.offsetHeight)

Win.height=win.contentDocument.body.offsetHeight

Else if (win.Document & & win.Document.body.scrollHeight)

Win.height=win.Document.body.scrollHeight

}

}

}

Finally, if you add iframe, you can't lose the onload attribute. Of course, id must also match the win in the function.

2. Program code:

Let's take a look at the iframe solution in another situation

Important note: the web address you must fill in in src= must be on the same site as this page, otherwise, you will make a mistake and say, "deny access!" (in fact, this is because access is denied because of Js's cross-domain problems.) now I'd like to share with you:

1. Create a bottom.js file, and then enter the following code

Parent.document.all ("frame ID name"). Style.height=document.body.scrollHeight

Parent.document.all ("frame ID name"). Style.width=document.body.scrollWidth

2. Add each of the included files in your website and pass the test under WINXP and IE6

Realize the adaptive height of iframe to realize the adaptive height of iframe, which can automatically adapt to the length of the page to avoid the phenomenon of scrollbars appearing in both the page and iframe at the same time.

Program code

/ /

/ / enter a list of the names of iframe whose height you want to automatically adjust according to the height of the page.

/ / separate the ID of each iframe with a comma. For example: ["myframe1", "myframe2"], you can have only one form without a comma.

/ / define the ID of iframe

Var iframeids= ["test"]

/ / if the user's browser does not support iframe, whether to hide iframe means to hide yes, no means not to hide

Var iframehide= "yes"

Function dyniframesize ()

{

Var dyniframe=new Array ()

For (iTuno; I)

This is the end of the article on "how to write php adaptive web code". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to write php adaptive web code". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report