Visualizzazione dei risultati da 1 a 4 su 4

Discussione: VBScript

  1. #1
    Utente bannato
    Registrato dal
    Oct 2002
    Messaggi
    122

    VBScript

    Buonasera a tutti!

    Vorrei il vostro aiuto per favore riguardo uno VBScript che vorrei trasformarlo in JavaScript. Oppure desidero sapere se esiste uno javascript simile in rete già pronto.

    Grazie per la vostra attenzione.

    __________________

    <script language=vbscript>
    Function ChiudiWin()
    window.close
    End Function
    </script>

    <style>

    p.dashed
    {
    background:#FFFFC0;
    border-top-width: 5px;
    border-bottom-style: dashed;
    border-bottom-width: 2px;
    border-left-width: 2px;
    border-left-style: dashed;
    border-right-width: 2px;
    border-right-style: dashed;
    }

    </style>
    </head>
    <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">


    <p class="dashed">
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
    <th bgcolor="black"><font style="font-family:Arial;font-size:14pt;color:#FF7F01" color=black>Zero Termico e Quota Neve</font></th>
    </table>
    <table border="0" cellspacing="0" cellpadding="3" width=100%>
    <tr>
    <td>Quota della località (in metri)</td><td><input align="right" size="5" name="altezza">mt</td>
    </tr>
    <tr>
    <td>Temperatura attuale della località</td><td><input align="right" size="5" name="temper">°C</td>
    </tr>
    <tr>
    <td>Stato del tempo in atto</td><td><select name="tempo"><option checked>Sereno</option><option>Poco Nuvoloso</option>
    <option>Nuvoloso</option><option>Coperto</option><option>Pioggia</option><option>Temporale</option><option>Neve</option></select></td>
    </tr>
    <tr>
    <td>Tasso attuale dell'umidità relativa</td><td><input align="right" size="5" name="umidita">%</td>
    </tr>
    <tr>
    <td>Intensità attuale del vento</td><td><select name="vento"><option checked>Calma</option><option>Debole</option>
    <option>Moderato</option><option>Forte</option></select></td>
    </tr>
    <tr>
    <td>Tipo di luogo dove si trova</td><td><select name="luogo"><option checked>Mare</option><option>Vetta di montagna</option>
    <option>In pianura</option><option>A valle</option><option>In collina</option></select></td>
    </tr>
    <tr>
    <td></td><td><input type="button" name="calcola" value="calcola" onclick="vbscript:calcola()"></td>
    </tr>
    <tr>
    <td><pre>[b]<font color="blue">Lo zero termico è stimato attualmente a circa</td><td><input align="right" size="5" name="zerot">mt</td>
    </tr>
    <tr>
    <td>[b]<pre><font color="blue">La quota neve si trova a circa</td><td><input align="right" size="5" name="qneve">mt</td>
    </tr></table>

    <p onmouseover="javascript:this.style.cursor='hand'" onmouseout="javascript:this.style.cursor='default' " style="font-family:verdana;font-size:8pt" align="center" onclick="ChiudiWin()">Chiudi</p>
    </center>



    </body>

    <script language="vbscript">
    Function Calcola()

    'if clng(temper.value) <=0 then
    ' zerot.value = "0"
    ' qneve.value = "0"
    ' exit Function
    ' end if

    if altezza.value = "" or temper.value = "" or umidita.value = "" then
    msgbox "Inerire le variabili necessarie sui campi appositi"
    exit function
    end if

    rh = 100
    select case tempo.selectedIndex
    case 1
    rh = rh *1.05
    case 2
    rh = rh * 1.4
    case 3
    rh = rh * 1.6
    case 4
    rh = rh * 1.8
    case 5
    rh = rh * 2
    case 6
    rh = rh * 1.6
    case 7
    rh = rh * 1.9
    end select

    select case vento.selectedIndex

    case 1
    rh = rh * 1.1
    case 2
    rh = rh * 1
    case 3
    rh = rh * 0.9
    case 4
    rh = rh * 0.7

    end select

    select case luogo.selectedIndex

    case 1
    rh = rh * 1.1
    case 2
    rh = rh * 0.9
    case 3
    rh = rh * 1.0
    case 4
    rh = rh * 0.8
    case 4
    rh = rh * 0.9

    end select

    rh = rh * (1- cdbl(umidita.value*0.0015))

    zerot.value = cstr(clng(clng(altezza.value) + (rh* cdbl(temper.value))))
    qneve.value = cstr(clng(clng(zerot.value) - (rh*2)))

    if clng(zerot.value) < 0 then
    zerot.value = "0"
    end if

    if clng(qneve.value) < 0 then
    qneve.value = "0"
    end if
    end Function
    </script>


    </p>

    __________________

  2. #2
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998

    Re: VBScript

    Se non ho preso qualche ...
    codice:
    
    <script language=javascript>
    function ChiudiWin() {
    	window.close()
    }
    </script>
    
    <style>
    
    p.dashed 
    {
    background:#FFFFC0;
    border-top-width: 5px;
    border-bottom-style: dashed;
    border-bottom-width: 2px;
    border-left-width: 2px;
    border-left-style: dashed;
    border-right-width: 2px;
    border-right-style: dashed;
    }
    		
    </style>
    </head>
    <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
    	
    	
    <p class="dashed">
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
    <th bgcolor="black"><font style="font-family:Arial;font-size:14pt;color:#FF7F01" color=black>Zero Termico e Quota Neve</font></th>
    </table>	
    <table border="0" cellspacing="0" cellpadding="3" width=100%>
    <tr>
    <td>Quota della località (in metri)</td><td><input align="right" size="5" name="altezza">mt</td>
    </tr>
    <tr>
    <td>Temperatura attuale della località</td><td><input align="right" size="5" name="temper">°C</td>
    </tr>
    <tr>
    <td>Stato del tempo in atto</td><td><select name="tempo"><option checked>Sereno</option><option>Poco Nuvoloso</option>
    <option>Nuvoloso</option><option>Coperto</option><option>Pioggia</option><option>Temporale</option><option>Neve</option></select></td>
    </tr>
    <tr>
    <td>Tasso attuale dell'umidità relativa</td><td><input align="right" size="5" name="umidita">%</td>
    </tr>
    <tr>
    <td>Intensità attuale del vento</td><td><select name="vento"><option checked>Calma</option><option>Debole</option>
    <option>Moderato</option><option>Forte</option></select></td>
    </tr>
    <tr>
    <td>Tipo di luogo dove si trova</td><td><select name="luogo"><option checked>Mare</option><option>Vetta di montagna</option>
    <option>In pianura</option><option>A valle</option><option>In collina</option></select></td>
    </tr>
    <tr>
    <td></td><td><input type="button" name="calcola" value="calcola" onclick="vbscript:calcola()"></td>
    </tr>
    <tr>
    <td><pre>[b]<font color="blue">Lo zero termico è stimato attualmente a circa</td><td><input align="right" size="5" name="zerot">mt</td>
    </tr>
    <tr>
    <td>[b]<pre><font color="blue">La quota neve si trova a circa</td><td><input align="right" size="5" name="qneve">mt</td>
    </tr></table>
    
    <p onmouseover="javascript:this.style.cursor='hand'" onmouseout="javascript:this.style.cursor='default'" style="font-family:verdana;font-size:8pt" align="center" onclick="ChiudiWin()">Chiudi</p>
    </center>
    
    
    
    </body>
    
    <script language="javascript"> 
    function Calcola() {
    
    // if parseFloat(temper.value) <=0 { 
    //	zerot.value = "0" 
    //	qneve.value = "0" 
    //	return false
    // } 
    
    if (altezza.value=="" || temper.value=="" || umidita.value=="") { 
    	alert("Inerire le variabili necessarie sui campi appositi") 
    	return false
    } 
    
    rh = 100 
    switch (tempo.selectedIndex) {
    	case 1 :
    		rh = rh * 1.05
    		break;
    	case 2 :
    		rh = rh * 1.4
    		break;
    	case 3 :
    		rh = rh * 1.6
    		break;
    	case 4 :
    		rh = rh * 1.8
    		break;
    	case 5 :
    		rh = rh * 2
    		break;
    	case 6 :
    		rh = rh * 1.6
    		break;
    	case 7 :
    		rh = rh * 1.9
    		break;
    }
    switch (vento.selectedIndex) { 
    
    	case 1 :
    		rh = rh * 1.1
    		break;
    	case 2 :
    		rh = rh * 1; 
    		break;
    	case 3 :
    		rh = rh * 0.9 
    		break;
    	case 4 :
    		rh = rh * 0.7 
    		break;
    }	
    switch (luogo.selectedIndex) { 
    	case 1 :
    		rh = rh * 1.1 
    		break;
    	case 2 :
    		rh = rh * 0.9 
    		break;
    	case 3 :
    		rh = rh * 1.0 
    		break;
    	case 4 :
    		rh = rh * 0.8 
    		break;
    	case 5 :
    		rh = rh * 0.9 
    		break;
    }
    
    rh = rh * (1 - parseFloat(umidita.value) * 0.0015) 
    
    zerot.value = parseFloat(altezza.value) + (rh * parseFloat(temper.value))
    qneve.value = parseFloat(zerot.value) - (rh * 2) 
    
    if (parseFloat(zerot.value) < 0) { 
    	zerot.value = "0" 
    }
    
    if (parseFloat(qneve.value) < 0) {
    	qneve.value = "0" 
    }
    }
    </script> 
    
    </p>
    
    Dato che non utilizzi piu' vbscript immagino debba essere eseguito su browser diversi da IE... allora tutti i campi dovrebbero esser racchiusi in un <form name="nomeForm"> ed i riferimenti modificati con il prefisso
    document.nomeForm.nomeCampo.value

    ciao
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

  3. #3
    Utente bannato
    Registrato dal
    Oct 2002
    Messaggi
    122
    L'obbiettivo è di visualizzare lo script su tutti i broswer. Per questo voglio trasformarlo in Javascript compatibile con i broswer più diffusi. Questo vbscript mi pare che è visualizzabile però con IE6.
    Ma non vorrei sbagliarmi.
    Ti ringrazio. ciao

  4. #4
    anch'io ho lo stesso problema con un VBscript...

    <%@ LANGUAGE = VBScript %>

    <%
    Function MeseIT(strDate)
    dim intLen
    dim strOutput, strChar

    strChar = trim(month(strDate))

    select case strChar
    case "1" strOutput="Gennaio"
    case "2" strOutput="Febbraio"
    case "3" strOutput="Marzo"
    case "4" strOutput="Aprile"
    case "5" strOutput="Maggio"
    case "6" strOutput="Giugno"
    case "7" strOutput="Luglio"
    case "8" strOutput="Agosto"
    case "9" strOutput="Settembre"
    case "10" strOutput="Ottobre"
    case "11" strOutput="Novembre"
    case "12" strOutput="Dicembre"

    end select

    MeseIT = strOutput

    End Function

    Function ShortMeseIT(strDate)
    dim intLen
    dim strOutput, strChar

    strChar = trim(month(strDate))

    select case strChar
    case "1" strOutput="Gen"
    case "2" strOutput="Feb"
    case "3" strOutput="Mar"
    case "4" strOutput="Apr"
    case "5" strOutput="Mag"
    case "6" strOutput="Giu"
    case "7" strOutput="Lug"
    case "8" strOutput="Ago"
    case "9" strOutput="Set"
    case "10" strOutput="Ott"
    case "11" strOutput="Nov"
    case "12" strOutput="Dic"

    end select

    ShortMeseIT = strOutput

    End Function

    Function GiornoSettimanaIT(strDate)
    dim intLen
    dim strOutput, strChar

    strChar = trim(weekday(strDate))

    select case strChar
    case "1" strOutput="Domenica"
    case "2" strOutput="Lunedì"
    case "3" strOutput="Martedì"
    case "4" strOutput="Mercoledì"
    case "5" strOutput="Giovedì"
    case "6" strOutput="Venerdi"
    case "7" strOutput="Sabato"

    end select

    GiornoSettimanaIT = strOutput

    End Function
    Function ShortGiornoSettimanaIT(strDate)
    dim intLen
    dim strOutput, strChar

    strChar = trim(weekday(strDate))

    select case strChar
    case "1" strOutput="Dom"
    case "2" strOutput="Lun"
    case "3" strOutput="Mar"
    case "4" strOutput="Mer"
    case "5" strOutput="Gio"
    case "6" strOutput="Ven"
    case "7" strOutput="Sab"

    end select

    ShortGiornoSettimanaIT = strOutput

    End Function

    Function Ora(strTime)
    dim intLen
    dim strOutput, strChar

    strChar = trim(hour(strTime))

    if len(strChar) < 2 then

    strOutput="0" & strChar
    else
    strOutput= strChar

    end if

    Ora = strOutput

    End Function
    Function Minuto(strTime)
    dim intLen
    dim strOutput, strChar

    strChar = trim(minute(strTime))

    if len(strChar) < 2 then

    strOutput="0" & strChar
    else
    strOutput= strChar

    end if

    Minuto = strOutput

    End Function

    SQLQuery="Select NewsID, nwsData, nwsTitolo, nwsDescrizione, nwsFotoFileName, nwsFoto, nwsFotoDescrizione, nwsCreated from News1 order by nwsOrdine"
    set Rs = objConnection.Execute( SQLQuery )
    %>
    ho provato a modificarlo in Javascript, ma il problema persiste nella visualizzazione su browser diversi da Explorer...

    <%@ LANGUAGE = Javascript %>

    <%
    Function MeseIT(strDate){
    var intLen
    var strOutput, strChar
    }

    strChar = trim(month(strDate))

    switch (strChar){
    case "1" strOutput="Gennaio"
    case "2" strOutput="Febbraio"
    case "3" strOutput="Marzo"
    case "4" strOutput="Aprile"
    case "5" strOutput="Maggio"
    case "6" strOutput="Giugno"
    case "7" strOutput="Luglio"
    case "8" strOutput="Agosto"
    case "9" strOutput="Settembre"
    case "10" strOutput="Ottobre"
    case "11" strOutput="Novembre"
    case "12" strOutput="Dicembre"
    }

    MeseIT = strOutput{
    }

    Function ShortMeseIT(strDate)
    var intLen
    var strOutput, strChar

    strChar = trim(month(strDate))

    switch (strChar){
    case "1" strOutput="Gen"
    case "2" strOutput="Feb"
    case "3" strOutput="Mar"
    case "4" strOutput="Apr"
    case "5" strOutput="Mag"
    case "6" strOutput="Giu"
    case "7" strOutput="Lug"
    case "8" strOutput="Ago"
    case "9" strOutput="Set"
    case "10" strOutput="Ott"
    case "11" strOutput="Nov"
    case "12" strOutput="Dic"
    }

    ShortMeseIT = strOutput {
    }

    Function GiornoSettimanaIT(strDate){
    var intLen
    var strOutput, strChar
    }

    strChar = trim(weekday(strDate))

    switch (strChar){
    case "1" strOutput="Domenica"
    case "2" strOutput="Lunedì"
    case "3" strOutput="Martedì"
    case "4" strOutput="Mercoledì"
    case "5" strOutput="Giovedì"
    case "6" strOutput="Venerdi"
    case "7" strOutput="Sabato"
    }

    GiornoSettimanaIT = strOutput{
    }
    Function ShortGiornoSettimanaIT(strDate){
    var intLen
    var strOutput, strChar
    }

    strChar = trim(weekday(strDate))

    switch (strChar){
    case "1" strOutput="Dom"
    case "2" strOutput="Lun"
    case "3" strOutput="Mar"
    case "4" strOutput="Mer"
    case "5" strOutput="Gio"
    case "6" strOutput="Ven"
    case "7" strOutput="Sab"
    }

    ShortGiornoSettimanaIT = strOutput{
    }

    Function Ora(strTime){
    var intLen
    var strOutput, strChar
    }

    strChar = trim(hour(strTime))

    if len(strChar) < 2 {

    // strOutput="0" & strChar
    // else
    // strOutput= strChar
    // return false
    // }

    Ora = strOutput{
    }

    Function Minuto(strTime){
    var intLen
    var strOutput, strChar

    }
    strChar = trim(minute(strTime)){
    }
    if len(strChar) < 2

    // strOutput="0" & strChar{
    // else
    // strOutput= strChar
    // return false
    // }

    Minuto = strOutput {
    }

    SQLQuery="Select NewsID, nwsData, nwsTitolo, nwsDescrizione, nwsFotoFileName, nwsFoto, nwsFotoDescrizione, nwsCreated from News1 order by nwsOrdine"
    set Rs = objConnection.Execute( SQLQuery )
    %>
    se voi mi sapete aiutare...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.