How can i make this Automatic function disabeldivs pls help mee

Discussion in 'JavaScript' started by jemy, Jan 27, 2008.

  1. #1
    hello i amm not good in java script but can som1 help me pls to mmake this div "shadow" automatic here i can make it in iframe "onclick" when i click first buton and to remmove that with second buton but i want that to be automatic when i login in page adn do not removed.....pls help here you have my page i like to move butons and that to be all atime shadowed here is my page


    and this is my code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <SCRIPT type=text/javascript>
    cDivs = new Array();
    function disableDivs()
    {
    d = document.getElementsByTagName("BODY")[0];
    for(x=0;x<arguments.length;x++)
    {
        if (document.getElementById(arguments[x]))
        {
        xPos = document.getElementById(arguments[x]).offsetLeft;
        yPos = document.getElementById(arguments[x]).offsetTop;
        oWidth = document.getElementById(arguments[x]).offsetWidth;    
        oHeight = document.getElementById(arguments[x]).offsetHeight;
        cDivs[cDivs.length] = document.createElement("DIV");
        cDivs[cDivs.length-1].style.width = oWidth+"px";
        cDivs[cDivs.length-1].style.height = oHeight+"px";
        cDivs[cDivs.length-1].style.position = "absolute";
        cDivs[cDivs.length-1].style.left = xPos+"px";
        cDivs[cDivs.length-1].style.top = yPos+"px";
        cDivs[cDivs.length-1].style.backgroundColor = "#999999";
        cDivs[cDivs.length-1].style.opacity = .6;
        cDivs[cDivs.length-1].style.filter = "alpha(opacity=60)";
        d.appendChild(cDivs[cDivs.length-1]);
        }
    }
    }
    function enableDivs()
    {
    for (hippopotamus=0;hippopotamus<cDivs.length;hippopotamus++)
    {
    document.getElementsByTagName("BODY")[0].removeChild(cDivs[hippopotamus]);
    }
    cDivs = [];
    }
    </SCRIPT>
    <BODY>
    <DIV id=d1><IFRAME id=myframe style="OVERFLOW: visible" marginWidth=0 
    marginHeight=0 
    src="http://google.com" 
    frameBorder=0 width=409 scrolling=no height=21 
    target="_blank"></IFRAME></DIV><BR><INPUT onclick="disableDivs('d1')" type=button value="Disable Those Divs"> 
    <INPUT onclick=enableDivs() type=button value="Remove Cover Divs"> </BODY></HTML>
    
    Code (markup):

     
    jemy, Jan 27, 2008 IP
  2. locdev

    locdev Active Member

    Messages:
    171
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    add
    <script>disableDivs('d1')</script>
    to the bottom of the page. or you can add a page onLoad event.

    can you give more detaild info of what you need
     
    locdev, Jan 28, 2008 IP
  3. jemy

    jemy Peon

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes man its working great thnks a lot from you are a king thnks a lot but man i have 1 question can you help me to be that "shadow" in half of iframe not all cuse he take all of iframe so i wuld like to mix 2 colos .....half of "shadow" to be like it is "shadow" with #99999 color and half to be "red" shadow in same iframe "d1" ...... so pls man can you help here you have modifyed script thnks a lot man
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <SCRIPT type=text/javascript>
    cDivs = new Array();
    function disableDivs()
    {
    d = document.getElementsByTagName("BODY")[0];
    for(x=0;x<arguments.length;x++)
    {
        if (document.getElementById(arguments[x]))
        {
        xPos = document.getElementById(arguments[x]).offsetLeft;
        yPos = document.getElementById(arguments[x]).offsetTop;
        oWidth = document.getElementById(arguments[x]).offsetWidth;    
        oHeight = document.getElementById(arguments[x]).offsetHeight;
        cDivs[cDivs.length] = document.createElement("DIV");
        cDivs[cDivs.length-1].style.width = oWidth+"px";
        cDivs[cDivs.length-1].style.height = oHeight+"px";
        cDivs[cDivs.length-1].style.position = "absolute";
        cDivs[cDivs.length-1].style.left = xPos+"px";
        cDivs[cDivs.length-1].style.top = yPos+"px";
        cDivs[cDivs.length-1].style.backgroundColor = "#999999";
        cDivs[cDivs.length-1].style.opacity = .6;
        cDivs[cDivs.length-1].style.filter = "alpha(opacity=60)";
        d.appendChild(cDivs[cDivs.length-1]);
        }
    }
    }
    function enableDivs()
    {
    for (hippopotamus=0;hippopotamus<cDivs.length;hippopotamus++)
    {
    document.getElementsByTagName("BODY")[0].removeChild(cDivs[hippopotamus]);
    }
    cDivs = [];
    }
    </SCRIPT>
    
    <META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
    <BODY>
    <DIV id=d1><IFRAME id=myframe 
    style="OVERFLOW: visible; WIDTH: 409px; HEIGHT: 207px" marginWidth=0 
    marginHeight=0 src="http://google.com" frameBorder=0 width=409 scrolling=no 
    height=21 target="_blank"></IFRAME></DIV><BR><script>disableDivs('d1')</script> </BODY></HTML>
    Code (markup):
     
    jemy, Jan 28, 2008 IP
  4. locdev

    locdev Active Member

    Messages:
    171
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #4
    try this
    also reputation change is ppreciated if the solution helped you ;)
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <SCRIPT type=text/javascript>
    cDivs = new Array();
    function disableDivs()
    {
    d = document.getElementsByTagName("BODY")[0];
    for(x=0;x<arguments.length;x++)
    {
        if (document.getElementById(arguments[x]))
        {
        xPos = document.getElementById(arguments[x]).offsetLeft;
        yPos = document.getElementById(arguments[x]).offsetTop;
        oWidth = document.getElementById(arguments[x]).offsetWidth;    
        oHeight = document.getElementById(arguments[x]).offsetHeight;
        cDivs[cDivs.length] = document.createElement("DIV");
        cDivs[cDivs.length-1].style.width = oWidth+"px";
        cDivs[cDivs.length-1].style.height = oHeight/2+"px";
        cDivs[cDivs.length-1].style.position = "absolute";
        cDivs[cDivs.length-1].style.left = xPos+"px";
        cDivs[cDivs.length-1].style.top = yPos+"px";
        cDivs[cDivs.length-1].style.backgroundColor = "#999999";
        cDivs[cDivs.length-1].style.opacity = .6;
        cDivs[cDivs.length-1].style.filter = "alpha(opacity=60)";
        d.appendChild(cDivs[cDivs.length-1]);
    	 cDivs[cDivs.length] = document.createElement("DIV");
        cDivs[cDivs.length-1].style.width = oWidth+"px";
        cDivs[cDivs.length-1].style.height = oHeight/2+"px";
        cDivs[cDivs.length-1].style.position = "absolute";
        cDivs[cDivs.length-1].style.left = xPos+"px";
        cDivs[cDivs.length-1].style.top = yPos+oHeight/2+"px";
        cDivs[cDivs.length-1].style.backgroundColor = "Red";
        cDivs[cDivs.length-1].style.opacity = .6;
        cDivs[cDivs.length-1].style.filter = "alpha(opacity=60)";
        d.appendChild(cDivs[cDivs.length-1]);
        }
    }
    }
    function enableDivs()
    {
    for (hippopotamus=0;hippopotamus<cDivs.length;hippopotamus++)
    {
    document.getElementsByTagName("BODY")[0].removeChild(cDivs[hippopotamus]);
    }
    cDivs = [];
    }
    </SCRIPT>
    
    <META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
    <BODY>
    <DIV id=d1><IFRAME id=myframe style="OVERFLOW: visible; WIDTH: 409px; HEIGHT: 207px" marginWidth=0 
    marginHeight=0 src="http://google.com" frameBorder=0 width=409 scrolling=no 
    height=21 target="_blank"></IFRAME></DIV><BR><script>disableDivs('d1')</script>
    <INPUT onClick="disableDivs('d1')" type=button value="Disable Those Divs" /> 
    <INPUT onClick="enableDivs()" type=button value="Remove Cover Divs" />
    </BODY></HTML>
    
    Code (markup):
     
    locdev, Jan 28, 2008 IP
  5. jemy

    jemy Peon

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hey man thnksssssssssss a lot you are king thnks a lot man its work perfekt youu helped me to much thnks a lot man i have just 1 question is it posible to cut example 10 % that to be black shadow and 90 % red shadow thnks man a lotttttttt
     
    jemy, Jan 28, 2008 IP
  6. locdev

    locdev Active Member

    Messages:
    171
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #6
    sure easy
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <SCRIPT type=text/javascript>
    cDivs = new Array();
    function disableDivs()
    {
    d = document.getElementsByTagName("BODY")[0];
    for(x=0;x<arguments.length;x++)
    {
        if (document.getElementById(arguments[x]))
        {
        xPos = document.getElementById(arguments[x]).offsetLeft;
        yPos = document.getElementById(arguments[x]).offsetTop;
        oWidth = document.getElementById(arguments[x]).offsetWidth;    
        oHeight = document.getElementById(arguments[x]).offsetHeight;
        cDivs[cDivs.length] = document.createElement("DIV");
        cDivs[cDivs.length-1].style.width = oWidth+"px";
        cDivs[cDivs.length-1].style.height = oHeight/10+"px";
        cDivs[cDivs.length-1].style.position = "absolute";
        cDivs[cDivs.length-1].style.left = xPos+"px";
        cDivs[cDivs.length-1].style.top = yPos+"px";
        cDivs[cDivs.length-1].style.backgroundColor = "#999999";
        cDivs[cDivs.length-1].style.opacity = .6;
        cDivs[cDivs.length-1].style.filter = "alpha(opacity=60)";
        d.appendChild(cDivs[cDivs.length-1]);
    	 cDivs[cDivs.length] = document.createElement("DIV");
        cDivs[cDivs.length-1].style.width = oWidth+"px";
        cDivs[cDivs.length-1].style.height = (oHeight/10)*9+"px";
        cDivs[cDivs.length-1].style.position = "absolute";
        cDivs[cDivs.length-1].style.left = xPos+"px";
        cDivs[cDivs.length-1].style.top = yPos+(oHeight/10)+"px";
        cDivs[cDivs.length-1].style.backgroundColor = "Red";
        cDivs[cDivs.length-1].style.opacity = .6;
        cDivs[cDivs.length-1].style.filter = "alpha(opacity=60)";
        d.appendChild(cDivs[cDivs.length-1]);
        }
    }
    }
    function enableDivs()
    {
    for (hippopotamus=0;hippopotamus<cDivs.length;hippopotamus++)
    {
    document.getElementsByTagName("BODY")[0].removeChild(cDivs[hippopotamus]);
    }
    cDivs = [];
    }
    </SCRIPT>
    
    <META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
    <BODY>
    <DIV id=d1><IFRAME id=myframe style="OVERFLOW: visible; WIDTH: 409px; HEIGHT: 207px" marginWidth=0 
    marginHeight=0 src="http://google.com" frameBorder=0 width=409 scrolling=no 
    height=21 target="_blank"></IFRAME></DIV><BR><script>disableDivs('d1')</script>
    <INPUT onClick="disableDivs('d1')" type=button value="Disable Those Divs" /> 
    <INPUT onClick="enableDivs()" type=button value="Remove Cover Divs" />
    </BODY></HTML>
    
    Code (markup):
    reputation + is appreciated if the solution helped you.
     
    locdev, Jan 31, 2008 IP