Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile a problem regarding if all division are hidden, alert ??

    hello

    I have some code to say if all dragable Divisions are hidden, pop up an alert box,, I am having troubles


    well have a look..

    this bit below is what I am working on

    function check () {
    if (document.all["folioweb1Div"+ "folioweb1Div"].style.visibility="hidden") {
    alert('check1');
    }

    here is all the code.. is there any easier ways to say if all the dragable divisions are hidden pop the alert box up ???

    function check() {
    if (document.all["folioweb1Div" + "folioweb1Div"].style.visibility="hidden") {
    alert('check1');
    }
    }
    function portfolio() {
    DynLayerInit()

    drag.add(folioweb1,folioweb2,folioweb3,folioweb4,folioweb5,folioprint1,folioprint2,folioprint3,folio print4,folioprint5)

    drag.addTargets(maintarget)
    drag.onDragDrop = hitTarget

    initMouseEvents()
    }
    function hitTarget() {
    document.all[this.obj.id].style.visibility = "hidden"
    window.open("
    this.obj.id+".htm",'foliomain')
    check ()
    }

    any ideas why it is not working.. I am not that hot at javascript

    thanks cheers for all the help
    Last edited by chris_angell; 07-25-2002 at 06:10 PM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    function check () { 
    if (document.all["folioweb1Div"+ "folioweb1Div"].style.visibility="hidden") { 
    alert('check1'); 
    }
    shouldn't your if statment look like this instead.

    Code:
    function check () { 
    if (document.all["folioweb1Div"+ "folioweb1Div"].style.visibility=="hidden") { 
    alert('check1'); 
    }

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    I have been think like this ??

    thanks to miko but but no jazz.. I have tried it many ways but

    any help with this one.. or if else statments

    var 1 = folioweb1Div.style.visibility
    var 2 = folioweb2Div.style.visibility
    var 3 = folioweb3Div.style.visibility

    function check() {
    if (1+2+3=="hidden") {
    alert("please!");
    return false;
    }
    }

    will this work,

    thanks
    Last edited by chris_angell; 07-25-2002 at 08:46 PM.
    <marquee>thanks</marquee>

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No, that can't work at all, javascript identifier names mustn't start with numbers so the interpreter can differentiate between ordinary numbers and variables.

    If you rename your variables say with a "vis" prepended, then the following should work for you:

    function check() {

    var vis1 = document.getElementById("folioweb1Div").style.visibility
    var vis2 = document.getElementById("folioweb2Div").style.visibility
    var vis3 = document.getElementById("folioweb3Div").style.visibility

    if (vis1 =="hidden" && vis2 == "hidden" && vis3 == "hidden") {
    alert("please!");
    return false;
    }
    }

    Note that in some cases, you can't read out the style values of elements, i.e. those defined by css classes immediately after they have been rendered by the browser.

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    thanks.. you have saved me

    thanks mordred.. you are a winner
    <marquee>thanks</marquee>

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    yet more difficulties...

    thanks for the help above.. things at the moment are looking good.. but I have now another question..

    in my code I have two dragable sections, print and web. but i have managed to make alert boxes come up when the five print or web divisions are hidden.. but I want when all divisions are hidden (print + web) the shake function to happen..

    for example, 5 web divs hidden = alert box
    for example, 5 print divs hidden = alert box
    for example, 10 web plus print divs hidden = shake

    here is my code what am I doing wrong ???????? it starts on hitTarget() then function checkweb()



    function shake(n) {
    if (parent.moveBy) {
    for (i = 3; i > 0; i--) {
    for (j = n; j > 0; j--) {
    parent.moveBy(0,i);
    parent.moveBy(i,0);
    parent.moveBy(0,-i);
    parent.moveBy(-i,0);
    }
    }
    }
    }
    function checkshake() {

    var left1 = document.getElementById("folioprint1Div").style.visibility
    var left2 = document.getElementById("folioweb1Div").style.visibility

    if (left1 =="visable" && left2 == "visable") {
    shake(1);
    return false;
    }
    }
    }

    function checkweb() {

    var vis1 = document.getElementById("folioweb1Div").style.visibility
    var vis2 = document.getElementById("folioweb2Div").style.visibility
    var vis3 = document.getElementById("folioweb3Div").style.visibility
    var vis4 = document.getElementById("folioweb4Div").style.visibility
    var vis5 = document.getElementById("folioweb5Div").style.visibility
    var vis6 = document.getElementById("folioprint1Div").style.visibility
    var vis7 = document.getElementById("folioprint2Div").style.visibility
    var vis8 = document.getElementById("folioprint3Div").style.visibility
    var vis9 = document.getElementById("folioprint4Div").style.visibility
    var vis10 = document.getElementById("folioprint5Div").style.visibility
    var left1 = document.getElementById("folioprint1Div").style.left
    var left2 = document.getElementById("folioweb1Div").style.left

    if (left1 =="100" && left2 == "100") {
    shake(1);
    return false;
    }
    if (vis1 =="hidden" && vis2 == "hidden" && vis3 == "hidden" && vis4 == "hidden" && vis5 == "hidden") {
    window.alert("that are a couple of sites I have done");
    moveandshowweb()
    return false;
    }
    if (vis6 =="hidden" && vis7 == "hidden" && vis8 == "hidden" && vis9 == "hidden" && vis10 == "hidden") {
    window.alert("that was some of my old print work");
    moveandshowprint()
    return false;
    }
    }
    function portfolio() {
    DynLayerInit()

    drag.add(folioweb1,folioweb2,folioweb3,folioweb4,folioweb5,folioprint1,folioprint2,folioprint3,folio print4,folioprint5)

    drag.addTargets(maintarget)
    drag.onDragDrop = hitTarget

    initMouseEvents()
    }
    function hitTarget() {
    document.all[this.obj.id].style.visibility = "hidden"
    window.open("mainpages/"+this.obj.id+".htm",'foliomain')
    document.dropname.src='images/web'+this.obj.id+'.gif'
    checkweb()
    }




    Last edited by chris_angell; 07-26-2002 at 06:32 PM.
    <marquee>thanks</marquee>

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: yet more difficulties...

    Originally posted by chris_angell
    if (left1 =="visable" && left2 == "visable") {
    shake(1);
    return false;
    Sorry I haven't got the time to test it completely, but this seems like a typo for me: Shouldn't it rather be "visible" instead?

  • #8
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up oooppps

    that was it,, what a dum *** ... cheers again ...

    please note that your help is fully appreciated
    <marquee>thanks</marquee>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •