i try to make a gui (hta) which can install on a client, one or more printers from the printer server.

the problem is when i create the button "install", the function is executed on form load and not by clicking on the button.

i don't understand why. can you help me please?

```
<HTML>
<HEAD> 
    <TITLE>printer installation</TITLE>
    <HTA:APPLICATION ID = 'AppBase'>

        <script language="VBScript">

    Dim WshNetwork, objPrinter, intDrive, intNetLetter
    strComputer = "change_printer_server_name_or_ip" 

    strHTML =  "<TABLE BORDER='0'>"

    Set WshNetwork = CreateObject("WScript.Network") 
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
    Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer") 
    For Each objPrinter in colInstalledPrinters 

        strHTML = strHTML & "<TR><TD><input type='button' value='install printer' name='" & objPrinter.Name & "' onclick='" & installprinter(printname, printserver) &"'>" & objPrinter.Name & "</input></TD><TD>" & objPrinter.Location  & "</TD><TD>" & objPrinter.portname & "</TD></TR>"

    next
    strHTML = strHTML & "</TABLE>"

    DataArea.InnerHTML = strHTML

    function installprinter(printname, printserver)
        Set WshNetwork = CreateObject ("WScript.Network")
        on error resume next
        PrinterPath = "\\" & printserver & "\" & printname
        WshNetwork.RemovePrinterConnection PrinterPath, true, true
        WshNetwork.AddwindowsPrinterConnection (PrinterPath)
        msgBox "L'imprimante a été installée avec succès"
    end function

    </script>
</HEAD>
<BODY>

     <span id="DataArea"></span>

</BODY>

```