Get the App
SLTechnology News&Howtos  ›  Development  › 

How to write php adaptive web page code

Shulou Source: shulou.com Published: 2022-06-01 05:53:07 10月04日 Update

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.

Tags: Code web page page height knowledge program content file frame article comma input important no value function only at the same time name address Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Technology Shulou Information OPPO Reno Redmi