|
-
September 17th, 2007, 09:14 PM
#1
variable check and modify
I need a function that will check a variables value and execute a function depending on the value. The value will always be either 0 or 1. If the variable is = to 0, then function 1 executes and changes the variables to 1. if the main function is called again, the second function will execute within it since the varibale is now 1. This will loop as described.
Heres what I did:
Code:
var wwidth = window.getWidth()-20;
var wheight = window.getHeight()-20;
var iwidth = window.getWidth()-20;
var iheight = window.getHeight()-68;
var tbontb = 0;
function maxchecker() {
if (tbontb == 0) {
function maxit() {
document.getElementById("wone").style.width=""+wwidth+"px";
document.getElementById("wone").style.height=""+wheight+"px";
document.getElementById("wone").style.top="0px";
document.getElementById("wone").style.left="0px";
document.getElementById("inner").style.width=""+iwidth+"px";
document.getElementById("inner").style.height=""+iheight+"px";
tbontb=1
}
}
if (tbontb == 1) {
function maxitback() {
document.getElementById("wone").style.width="500px";
document.getElementById("wone").style.height="200px";
document.getElementById("inner").style.width="498px";
document.getElementById("inner").style.height="200px";
tbontb=0
}
}
}
Wont seem to work at all
see I need either of the functions I mentioned above (maxit or maxitback) to execute when an "a" element is clicked on in the html body.
so Id need something like this:
<a href="..." onmousedown="maxchecker();">..</a>
so when that element is pressed, either one of the functions is executed depending on the tbontb value
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|