Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Disattivazione pulsanti di submit dopo invio

    Ciao a tutti,

    Avevo uno script che faceva questa cosa, ma stranamente non riesco più a farlo funzionare.

    Qualcuno mi darebbe una mano ?

    dovrebbe essere questo:

    codice:
    if (document.all || document.getElementById) {
        for (i = 0; i < theform.length; i++) {
        var tempobj = theform.elements[i];
        if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
        tempobj.disabled = true;
        }
    Me ne intendo molto poco di javascript, grazie 1000
    SGr33n

  2. #2
    Utente di HTML.it L'avatar di pietro09
    Registrato dal
    Jan 2002
    Messaggi
    10,116
    Per me è corretto


    una paginetta di prova che lo usa è:
    codice:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    	<head>
    		<title>a</title>
    		<meta name="vs_defaultClientScript" content="JavaScript">
    		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    		<meta name="ProgId" content="VisualStudio.HTML">
    		<meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
    		<script language="javascript">
    <!--
    function valida(v)
    {
    	if(v.elements[0] && v.elements[0].value == "")
    	{
    		alert("Devi riempire il campo!");
    		return;
    	}
    	else
    	{
    		if (document.all || document.getElementById) 
    		{
    			for ( var i = 0; i < v.length; i++) 
    			{
    				var tempobj = v.elements[i];
    				if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset") tempobj.disabled = true;
    			}		
    		}
    		window.open("", "popup", "left=300px, top=300px, width=300px, height=300px");
    		v.target = "popup";
    		v.submit();
    	}
    }
    //-->
    </script>
    
    	</head>
    	<body MS_POSITIONING="FlowLayout">
    		<form action="?"  onsubmit=";valida(this);return false;">
    			<INPUT type="text" ID="Text1" NAME="Text1">
    			<INPUT type="reset" value="Reset" ID="Reset1" NAME="Reset1">
    			<INPUT type="submit" value="Submit" ID="Submit1" NAME="Submit1">
    		</form>
    	</body>
    </html>
    Pietro

  3. #3
    grazie... lo riprovo meglio allora :P
    SGr33n

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 © 2025 vBulletin Solutions, Inc. All rights reserved.