简体   繁体   中英

window.onload Javascript, with functions that receives parameter?

I have this function:

<script type="text/javascript">
    var car = document.getElementById("Carros").value;
    window.onload = ChangeValue(car);

    function ChangeValue(str)
    {   
       ....
    }   

See that ChangeValue(str) receives a parameter, how may I make it start in the pageLoad?
using javascript ! The parameter I pass is a <select id="" onChange="ChangeValue(this.value)">

window.onload = function () {
    var car = document.getElementById("Carros").value;
    ChangeValue(car);
}

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