简体   繁体   中英

Run Javascript snow onclick

I'm trying to run Dynamic Drive's JS Snow only ( http://www.dynamicdrive.com/dynamicindex3/snow.htm ) once the user has clicked the button.

I have tried enclosing all the code in a function and running the function onclick but it just puts me on a white page with the snow frozen.

How would I do this?

1) Move this part into separate function:

function startStuff() {
    if (ie4up||ns6up){
        snowIE_NS6();
    if (hidesnowtime>0)
        setTimeout("hidesnow()", hidesnowtime*1000)
    }
}

2) Assign onclick event like <a href="#" onclick="startStuff()">start</a>

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