Display different connections at different resolutions

Source: Internet
Author: User
Tags copy reference window
Resolution | display

Generally we are in the 800*600 resolution to do the page, if the page set the center alignment,
That at different resolutions, such as 1024*768,
The position of the layer will be very big deviation,
This provides an easy way to

Reference Code One:
Add the following script in

Code Copy Box
function Pageinit () {var xxx= (window.screen.width-800)/2+565; Layer1.style.left=xxx;}
[Ctrl + a All select and copy]

Then add in <body>
This is through the different resolution of the location of the calculation layer, Layer1 is the layer in the page, 565 is this layer in the 800*600 of the left value, for the death of the page is better, if there are multiple layers on each of these settings.

Reference Code two:

Code Copy Box
<script>window.open (); function window.open () {return false;} </script><script>if (!window.open ()) {if (screen.width = a) && (screen.height = = 600)) { document.write ("<a Href=javascript:noborderwin" (Connection address, ' a ', ', ', ' #024580 ', ' #333333 ', ' #CCCCCC ', ') >link1 </a> ");} else if ((screen.width = = 1024) && (screen.height = = 768)) {document.write ("<a href=javascript:noborderwin" (' Connection address ', ' 1024 ', ' 768 ', ' #024580 ', ' #333333 ', ' #CCCCCC ', ') >link2</a> '); Else{document.write ("<a Href=javascript:noborderwin", "The link Address", "the", "the", "#024580", ' #333333 ', ' #CCCCCC ', ') >link3</a> ");} </script>
[Ctrl + a All select and copy]

Reference Code Three:
Under the

Code Copy Box
<script language= "JavaScript1.2" ><!--if (screen.width==800| | screen.height==600)//if 800x600window.location.replace ("http://siyizhu.com/800600.htm") else if (screen.width==640 || screen.height==480)//if 640x480window.location.replace ("http://siyizhu.com/640480.htm") else if (screen.width== 1024| | screen.height==768)//if 1024x768window.location.replace ("http://siyizhu.com/1024768.htm") Else//if all Elsewindow.location.replace ("http://siyizhu.com")//--></script>
[Ctrl + a All select and copy]



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.