danacton
04-14-2005, 01:47 AM
Hi, It's been awhile since I've needed your expert help with js.
I've created a page that is 800 x 600 and this is all tables and sliced images. Then to the right of this i created a div/layer that is 224 x 600. Inside of this layer I plan to nest a swf file.
My goal is to have the entire div be hidden (display:none) when the user drags or sets the browser window equal to or below 800px.
I was starting out with the code below that I pasted from
http://www.useractive.com/learning/dhtml/dhtmltut10.php3
As it is, I'm already getting the error: Object required: line 13. Hmmm!?
<script language=javascript>
if(navigator.appName == "Netscape"){
windowwidth = window.innerWidth;
windowheight = window.innerHeight;
}else if(navigator.appName == "Microsoft Internet Explorer"){
windowwidth = document.body.clientWidth;
windowheight = document.body.clientHeight;
}else{
windowwidth = "can't tell you";
}
document.open();
document.write("<br>screen width = " + screen.availWidth);
document.write("<br>screen height = " + screen.availHeight);
document.write("<br>this window width = " + windowwidth);
document.write("<br>this window height = " + windowheight);
document.close();
</script>
After I get the first part working, then I need to be able to tell it how to hide my layer?
I can't figure out how to put the logic together other than:
If(window.innerwidth =< 800){
document.getElementById(whichLayer).style.visibility = "hidden"
};
Here is some code I was using to try to figure out the logic of hiding divs
function hideLayer(whichLayer) {
if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "hidden";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "hidden";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "hidden";
}
Any help you have would be GREATLY appreciated :)
Dan
I've created a page that is 800 x 600 and this is all tables and sliced images. Then to the right of this i created a div/layer that is 224 x 600. Inside of this layer I plan to nest a swf file.
My goal is to have the entire div be hidden (display:none) when the user drags or sets the browser window equal to or below 800px.
I was starting out with the code below that I pasted from
http://www.useractive.com/learning/dhtml/dhtmltut10.php3
As it is, I'm already getting the error: Object required: line 13. Hmmm!?
<script language=javascript>
if(navigator.appName == "Netscape"){
windowwidth = window.innerWidth;
windowheight = window.innerHeight;
}else if(navigator.appName == "Microsoft Internet Explorer"){
windowwidth = document.body.clientWidth;
windowheight = document.body.clientHeight;
}else{
windowwidth = "can't tell you";
}
document.open();
document.write("<br>screen width = " + screen.availWidth);
document.write("<br>screen height = " + screen.availHeight);
document.write("<br>this window width = " + windowwidth);
document.write("<br>this window height = " + windowheight);
document.close();
</script>
After I get the first part working, then I need to be able to tell it how to hide my layer?
I can't figure out how to put the logic together other than:
If(window.innerwidth =< 800){
document.getElementById(whichLayer).style.visibility = "hidden"
};
Here is some code I was using to try to figure out the logic of hiding divs
function hideLayer(whichLayer) {
if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "hidden";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "hidden";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "hidden";
}
Any help you have would be GREATLY appreciated :)
Dan