Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it L'avatar di Gabbro
    Registrato dal
    Nov 2000
    Messaggi
    828

    Spostare il prompt su un campo input

    Salve,
    come è possibile fare in modo che dato un form il prompt si trovi su un campo input appena la pagina si apre? un pò come fà google: se andate su google appena la pagina si apre è possibile scrive il testo che si cerca senza cliccare con il mouse sul campo input di ricerca.

  2. #2
    Prova con JS:

    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>focus su input</title>
    
    <script type="text/javascript">
    function webdemofocus(){
    document.getElementById('inputfocus').focus();
    }
    </script>
    </head>
    
    <body onload="webdemofocus()">
    <form action="">
    
    
    <input name="testo" type="text" id="inputfocus" /></p>
    </form>
    </body>
    </html>

    chiaramente e' un esempio, il form va costruito...


    ciaux

  3. #3
    Utente di HTML.it L'avatar di Gabbro
    Registrato dal
    Nov 2000
    Messaggi
    828
    Originariamente inviato da webdemo
    Prova con JS:

    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>focus su input</title>
    
    <script type="text/javascript">
    function webdemofocus(){
    document.getElementById('inputfocus').focus();
    }
    </script>
    </head>
    
    <body onload="webdemofocus()">
    <form action="">
    
    
    <input name="testo" type="text" id="inputfocus" /></p>
    </form>
    </body>
    </html>

    chiaramente e' un esempio, il form va costruito...


    ciaux
    grazie. è possibile anche inserire il prompt all'inizio del campo text poichè questo campo ha già del testo dentro?

  4. #4
    Utente di HTML.it L'avatar di Gabbro
    Registrato dal
    Nov 2000
    Messaggi
    828
    up

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.