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 3 of 3
  • Thread Tools
  • Rate This Thread
  1. #1
    New to the CF scene
    Join Date
    Apr 2016
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    translate into array

    the following prevents images from being displayed on a page:

    #page-122176973 #image_894863711 {
    display: none !important;
    }
    #page-122176973 #image_894668871 {
    display: none !important;

    }

    in actuality, there are MANY images which shouldn't be displayed. As experiment
    tried the following:

    var imgarray=["894863711","894668871"];
    var len=imgarray.length;
    for i=0; i<len;i++){
    #page-122176973 #image_imgarray[i];
    display: none !important;
    }

    doesn't work...where did I goof?

    Thanks

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    6,251
    Thanks
    30
    Thanked 859 Times in 857 Posts
    JS changes the DOM not CSS.
    try:
    Code:
    <script type="text/javascript">
    if(document.getElementById("page-122176973")){
    	document.getElementById("image_894863711").style.display="none";
    }
    </script>
    Last edited by sunfighter; 04-08-2016 at 04:59 PM.
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. #3
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    3,473
    Thanks
    57
    Thanked 633 Times in 628 Posts
    It would make more sense to add a class to the undesired images and handle the whole thing with css


 

Tags for this Thread

Posting Permissions

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