Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
Results 1 to 3 of 3
Thread: translate into array
-
04-08-2016, 03:07 PM #1New 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
-
04-08-2016, 04:55 PM #2Master Coder
- 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.
-
04-08-2016, 11:30 PM #3
It would make more sense to add a class to the undesired images and handle the whole thing with css



Reply With Quote
