visual.harmony
11-18-2005, 02:20 AM
Hello,
I am in process of developing my design portfolio (all Flash) and it also uses a pattern background. I can see issues arising from this when it comes to different resolutions and the way it will be viewed, since the .swf has to be positioned absolutely so the pattern on the background will be flush. My main problem is i have little to no experience programming Javascript. I have searched through these forums and found a few but i do not know what to do to edit them so that they can fit my need. What i am trying to do is create one "Enter" link from my splash page, but have the popup show a different page depending on the users screen resolution so my .swf will display centered on every resolution, while maintaining a flush pattern on the background. I have searched through this site and found this script written by Coothead:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>browser sniffer</title>
<base href="http://coothead.homestead.com/files/"/>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<style type="text/css">
/*<![CDATA[*/
body {
background-image:url(bodyBg.jpg);
}
#splash {
display:block;
border:5px double #000;
margin:auto;
}
/*//]]>*/
</style>
<script type="text/javascript">
//<![CDATA[
var w=screen.width;
var h=screen.height;
function sniffer() {
if((w==800)&&(h==600)) {
document.getElementById('splash').src='apple.jpg';
}
else if((w==1024)&&(h==768)) {
document.getElementById('splash').src='banana.jpg';
}
else if((w==1152)&&(h==864)) {
document.getElementById('splash').src='girl.jpg';
}
else if((w==1280)&&(h==768)) {
document.getElementById('splash').src='aaa.jpg';
}
else if((w==1280)&&(h==960)) {
document.getElementById('splash').src='ten_quid.jpg';
}
else if((w==1280)&&(h==1024)) {
document.getElementById('splash').src='dog.jpg';
}
}
onload=sniffer;
//]]>
</script>
</head>
<body>
<div>
<img id="splash" src="apple.jpg" alt=""/>
</div>
</body>
</html>
Can someone help me understand and modify this code to fit my need? I greatly appreciate any help given. Thanks!
I am in process of developing my design portfolio (all Flash) and it also uses a pattern background. I can see issues arising from this when it comes to different resolutions and the way it will be viewed, since the .swf has to be positioned absolutely so the pattern on the background will be flush. My main problem is i have little to no experience programming Javascript. I have searched through these forums and found a few but i do not know what to do to edit them so that they can fit my need. What i am trying to do is create one "Enter" link from my splash page, but have the popup show a different page depending on the users screen resolution so my .swf will display centered on every resolution, while maintaining a flush pattern on the background. I have searched through this site and found this script written by Coothead:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>browser sniffer</title>
<base href="http://coothead.homestead.com/files/"/>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<style type="text/css">
/*<![CDATA[*/
body {
background-image:url(bodyBg.jpg);
}
#splash {
display:block;
border:5px double #000;
margin:auto;
}
/*//]]>*/
</style>
<script type="text/javascript">
//<![CDATA[
var w=screen.width;
var h=screen.height;
function sniffer() {
if((w==800)&&(h==600)) {
document.getElementById('splash').src='apple.jpg';
}
else if((w==1024)&&(h==768)) {
document.getElementById('splash').src='banana.jpg';
}
else if((w==1152)&&(h==864)) {
document.getElementById('splash').src='girl.jpg';
}
else if((w==1280)&&(h==768)) {
document.getElementById('splash').src='aaa.jpg';
}
else if((w==1280)&&(h==960)) {
document.getElementById('splash').src='ten_quid.jpg';
}
else if((w==1280)&&(h==1024)) {
document.getElementById('splash').src='dog.jpg';
}
}
onload=sniffer;
//]]>
</script>
</head>
<body>
<div>
<img id="splash" src="apple.jpg" alt=""/>
</div>
</body>
</html>
Can someone help me understand and modify this code to fit my need? I greatly appreciate any help given. Thanks!