T
toomanyjoes
This is a script I found off this group. I'm trying to modify it.
Here is the original:
<SCRIPT type="text/javascript"><!--
function adjustMain() {
document.all.Main.style.pixelHeight=document.body.clientHeight-100;
if(navigator.userAgent.indexOf("Win") != -1) {
document.all.Main.style.pixelWidth=document.body.clientWidth-135; }
}//-->
</SCRIPT>
Pretty Straighforward it adjusts the height and width of a layer when
the window is loaded or resized. Here's the script that calls it.
<SCRIPT type="text/javascript"><!-- // IE only
if (navigator.appName == "Microsoft Internet Explorer") {
window.onload=adjustMain; window.onresize=adjustMain; }//-->
</SCRIPT>
I didn't like that the layer name "Main" was hardcoded, so I'm trying
to make it more reusable. By passing more arguments and then looping
through the argument names and applying the same settings to each
layer.
Here's what I wrote:
function adjustMain() {
var layerArgs = adjustMain.arguments;
for (i=0; i<layerArgs.length;i++) {
document.all.layerArgs.style.pixelHeight=document.body.clientHeight-58;
if(navigator.userAgent.indexOf("Win") != -1) {
document.all.layerArgs.style.pixelWidth=document.body.clientWidth-50;
}
}
}
And here's what I wrote to call it:
if (navigator.appName == "Microsoft Internet Explorer") {
window.onload=adjustMain('WindowOne', 'WindowTwo');
window.onresize=adjustMain('WindowOne', 'WindowTwo'); }
It doesn't work and I think I know why, I'm passing it a string so it
cannot apply the style changes. I'm new to this is it painfully
obvious what I'm doing wrong? Can anyone help?
Thanks,
Gabriel Elizondo
Here is the original:
<SCRIPT type="text/javascript"><!--
function adjustMain() {
document.all.Main.style.pixelHeight=document.body.clientHeight-100;
if(navigator.userAgent.indexOf("Win") != -1) {
document.all.Main.style.pixelWidth=document.body.clientWidth-135; }
}//-->
</SCRIPT>
Pretty Straighforward it adjusts the height and width of a layer when
the window is loaded or resized. Here's the script that calls it.
<SCRIPT type="text/javascript"><!-- // IE only
if (navigator.appName == "Microsoft Internet Explorer") {
window.onload=adjustMain; window.onresize=adjustMain; }//-->
</SCRIPT>
I didn't like that the layer name "Main" was hardcoded, so I'm trying
to make it more reusable. By passing more arguments and then looping
through the argument names and applying the same settings to each
layer.
Here's what I wrote:
function adjustMain() {
var layerArgs = adjustMain.arguments;
for (i=0; i<layerArgs.length;i++) {
document.all.layerArgs.style.pixelHeight=document.body.clientHeight-58;
if(navigator.userAgent.indexOf("Win") != -1) {
document.all.layerArgs.style.pixelWidth=document.body.clientWidth-50;
}
}
}
And here's what I wrote to call it:
if (navigator.appName == "Microsoft Internet Explorer") {
window.onload=adjustMain('WindowOne', 'WindowTwo');
window.onresize=adjustMain('WindowOne', 'WindowTwo'); }
It doesn't work and I think I know why, I'm passing it a string so it
cannot apply the style changes. I'm new to this is it painfully
obvious what I'm doing wrong? Can anyone help?
Thanks,
Gabriel Elizondo