简体   繁体   中英

change div style with from my javascript code

can some one help me by adding some some code on my code that works for me here is what i need ..

my full code is here http://jsfiddle.net/2urmku1h/

here i need change

<div style="display:none;">Change style of this div to Block fro js above</div> 

and here is some of my js code that is in head section i need it some how to work

function startChecking() {
    secondsleft -= 1e3;
    document.querySelector(".load_video").innerHTML = "Please Wait.. " + Math.abs(secondsleft / 1e3) + " Seconds";
    if (secondsleft == 0) {
        clearInterval(interval);
        document.querySelector(".load_video").style.display = "none";
        document.querySelector(".frame_src").style.display = "";
        document.querySelector(".frame_src").src = document.querySelector(".frame_src").getAttribute("data-src")
    }
}

function startschedule() {
    clearInterval(interval);
    secondsleft = threshold;
    document.querySelector(".load_video").innerHTML = "Please Wait.. " + Math.abs(secondsleft / 1e3) + " Seconds";
    interval = setInterval(function() {
        startChecking()
    }, 1e3)
}

function resetTimer() {
    startschedule()
}
var timeout, interval;
var threshold = 1e4;
var secondsleft = threshold;
window.onload = function() {
    startschedule()
}

what i need is, if i clicked on one of video links it will stop countdown whether it's 5 seconds left or what ever, it will stop countdown and hiide this div <div class="load_video"></div>

and show the iframe. but i want it like, when i clicked one of that buttons it does hide load_video div and show iframe but i want it also it change style of this div <div style="display:none;">Change style of this div to Block fro js above</div> display to block.

hope you guys understand

There are many ways in which you could select the div element in which you are referencing. For simplicity, suppose you add an id to the div...

<div id="modifyMe" style="display:none;">Change style of this div to Block fro js above</div>

...then add the following code where you would like the change the div to display block.

jQuery solution:

$('#modifyMe').show();

Without jQuery:

document.getElementById('modifyMe').style.display = 'block';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM