Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    379

    attivazione di un testo in un imput

    ragazzi ho un problema anzi mi serve un consiglio. volevo chiedere se fosse possibile attraverso un tag a crocietta attivare o disattivare una funzione in questo caso quello si scrivere o no l'e-mail nel imput ?? se non sn riuscito a spiegarmi bene posso darvi qualche indicazione in + [in pratica cio che intendo è, se possibile attraverso ad un tag a crocietta attivare e disattivare una scritta dentro un imput] vi ringrazie gia in anticipo



    Codice PHP:
    <?PHP $reqlevel 1;?>
    <?php
    $f 
    = @$_GET['f'];
    $t = @$_GET['t'];

    if (!isset(
    $f)) $f=0;
    if (!isset(
    $t)) $t=-1;

    require(
    'functions.php');
    include (
    "../../config.php");

    $forums=load_index();
    set_index($forums[$f]);
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
    <title><?php echo "$look_title | $i_name?></title>
    <link rel="stylesheet" type="text/css" href="style/style.css">
    <link rel="help" href="help.html">
    <link rel="index" href="./">
    <link rel="copyright" href="copyright.html">
    <link rel="home" href="<?php echo $look_home ?>">
    <link rel="up" href="thread.php?f=<?php echo $f ?>">
    <script language="javascript" type="text/javascript"><!--

    key_b=key_i=key_u=0;

    function keyp(which) {
        switch (which) {
            case 0:
                if (!key_b) {
                    key_b=1;
                    document.form.text.value+='[B]';
                    document.form.but0.value='..B';
                } else {
                    key_b=0;
                    document.form.text.value+='[/B]';
                    document.form.but0.value='B..';
                }
            break;
            case 1:
                if (!key_i) {
                    key_i=1;
                    document.form.text.value+='[I]';
                    document.form.but1.value='..I';
                } else {
                    key_i=0;
                    document.form.text.value+='[/I]';
                    document.form.but1.value='I..';
                }
            break;
            case 2:
                if (!key_u) {
                    key_u=1;
                    document.form.text.value+='[U]';
                    document.form.but2.value='..U';
                } else {
                    key_u=0;
                    document.form.text.value+='[/U]';
                    document.form.but2.value='U..';
                }
            break;
            case 3:
                document.form.text.value+='[URL='+prompt('Please, insert the full page address', 'http://')+']'+prompt('Please, insert the page title', 'Page')+'[/URL]';
            break;
            case 4:
                document.form.text.value+='[IMG]'+prompt('Please, insert the full image address', 'http://')+'[/IMG]';
            break;
            case 5:
                document.form.text.value+='[EMAIL]'+prompt('Please, insert the eMail address', 'address@email')+'[/EMAIL]';
            break;
        }
        document.form.text.focus();
    }

    function check() {
        if (document.form.author.value.length==0) {
            alert("Please insert a Name before submit!");
            return false;
        }
    <?php if ($t==-1) { ?>    
        if (document.form.title.value.length==0) {
            alert("Please insert a Title before submit!");
            return false;
        }
    <?php ?>
        if (document.form.text.value.length==0) {
            alert("Please insert some Text before submit!");
            return false;
        }
        a=b=0;
        if (document.form.text.value.search(/\[B\]/)>-1) a=document.form.text.value.match(/\[B\]/g).length;
        if (document.form.text.value.search(/\[\/B\]/)>-1) b=document.form.text.value.match(/\[\/B\]/g).length;
        while(a<b) {
            document.form.text.value+='[B]';
            a++;
        }
        while(a>b) {
            document.form.text.value+='[/B]';
            b++;
        }

        a=b=0;
        if (document.form.text.value.search(/\[I\]/)>-1) a=document.form.text.value.match(/\[I\]/g).length;
        if (document.form.text.value.search(/\[\/I\]/)>-1) b=document.form.text.value.match(/\[\/I\]/g).length;
        while(a<b) {
            document.form.text.value+='[I]';
            a++;
        }
        while(a>b) {
            document.form.text.value+='[/I]';
            b++;
        }

        a=b=0;
        if (document.form.text.value.search(/\[U\]/)>-1) a=document.form.text.value.match(/\[U\]/g).length;
        if (document.form.text.value.search(/\[\/U\]/)>-1) b=document.form.text.value.match(/\[\/U\]/g).length;
        while(a<b) {
            document.form.text.value+='[U]';
            a++;
        }
        while(a>b) {
            document.form.text.value+='[/U]';
            b++;
        }

        expires = new Date();
        expires.setMonth(expires.getMonth()+2);
        nocookie = new Date();
        expires.setMonth(expires.getMonth()-1);
        if (document.form.save_author.checked) {
            document.cookie='cook_author='+document.form.author.value+';expires='+expires.toGMTString();
        } else {
            document.cookie='cook_author='+document.form.author.value+';expires='+nocookie.toGMTString();
        }
        if (document.form.save_email.checked) {
            document.cookie='cook_email='+document.form.email.value+';expires='+expires.toGMTString();
        } else {
            document.cookie='cook_email='+document.form.email.value+';expires='+nocookie.toGMTString();
        }
        
        return true;
    }
    --></script>
    </head>
    <body>

    <?php include ("../membersonly.inc.php"); ?>

    <div align="center">[img]<?php echo $look_logo ?>[/img]
    <form action=new_exe.php method=post onsubmit="return check();" name=form>
    <table class="main" cellspacing=0 align=center>
    <tr><td class="title" colspan="3"><?php if ($t==-1) echo 'New Thread'; else echo 'Add post'?> </td></tr>
    <tr>
    <td style="width:45%;text-align:right">[b]Nick[/b]</td>
            <td><input name=author readonly value="<?php echo ("$user_currently_loged"); ?>"></td>
    <td style="width:45%;text-align:left"><input type=checkbox checked name=save_author> <span class=mini>Memorizza</span></td>
    </tr><tr>
    <td style="text-align:right">

    [b]la tua eMail[/b] (optional)</td>
    <td><input name=email value=" <?PHP  
            
    // print the mailadres retrieved from the database
            //htmlspecialchars() is used to make sure the users can't put any (working) html code in
            //there name that would screw up the admin page
            
    echo htmlspecialchars($row["mailadres"],ENT_QUOTES); ?>"></td>
    <td style="width:45%;text-align:left"><input type=checkbox checked name=save_email> <span class=mini>Memorizza</span></td>
    </tr>
    <?php if ($t==-1) echo '<tr><td style="text-align:right">

    [b]Titolo del Thread[/b]</td><td colspan="2"><input name=title></td></tr>'
    ?>
    <tr><td style="text-align:center" colspan="3">
    <input name=but0 type=button value="B.." onclick="keyp(0)">
    <input name=but1 type=button value="I.." onclick="keyp(1)">
    <input name=but2 type=button value="U.." onclick="keyp(2)">
    <input type=button value="URL" onclick="keyp(3)">
    <input type=button value="Immagine" onclick="keyp(4)">
    <input type=button value="eMail" onclick="keyp(5)">

    <textarea name=text cols=60 rows=8></textarea>
    </td></tr>
    <tr><td colspan="3" style="text-align:center">
    <input type=button value=Annulla onclick="history.back()">
    <input type=reset value=Reset>
    <input style="border-color:white" type=submit value=Invio>
    <input type=hidden name=f value=<?php echo $f ?>>
    <input type=hidden name=t value=<?php echo $t ?>>
    <input type=hidden name=time value=<?php echo time() ?>>
    </td></tr>
    <tr><td colspan="3" class="copyright">[url="index.php"]Home[/url]</td></tr>
    </table>
    </form>
      

     </div>
    </body>
    </html>

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    379
    buddy

  3. #3
    Utente di HTML.it L'avatar di Il_Drugo
    Registrato dal
    May 2006
    Messaggi
    1,220
    Certo che si può...con Javascript pero'...
    Chiedi nel forum apposito che ti danno la dritta giusta di sicuro.
    PHP qui non c'azzecca una pigna



    PS: per "tag a crocetta" intendi una checkbox???

  4. #4
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    379
    si una checkbox non sai darmi una mano tu?? senza che rifaccio tutta una pappardella dilà??

  5. #5
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    379
    dire il vero mi servirebbe solo un checkbox che mi toglie e attiva questa scritta scritta in rosso:

    tr>
    <td style="text-align:right">

    la tua eMail (optional)</td>
    <td><input name=email value=" <?PHP echo htmlspecialchars($row["mailadres"],ENT_QUOTES); ?> "></td>
    <td style="width:45%;text-align:left"><input type=checkbox checked name=save_email> <span class=mini>Memorizza</span></td>
    </tr>



    ti prego dimmi che fare

  6. #6
    Utente di HTML.it L'avatar di Il_Drugo
    Registrato dal
    May 2006
    Messaggi
    1,220
    esempio base:

    Codice PHP:
    <script>
    function 
    check_stato(form)
    {
        if(
    form.controllo.checked)
        {
            
    form.testo.disabled false;
        }
        else
        {
            
    form.testo.disabled true;
        }
    }
    </script>

    <form name="test">
    <input type="checkbox" onchange="check_stato(this.form)" name="controllo" />
    <input type="text" value="inserisci qui" name="testo"  />
    </form> 
    Credo ti sarà abbastanza semplice riadattarlo al tuo caso specifico.


  7. #7
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    379
    Codice PHP:
    :D  :D hihi sorry ci ho provato e da ignorante nn celo fatta  :jam:  :jammi daresti una mano?? 

  8. #8
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    379
    Codice PHP:
     hihi sorry ci ho provato e da ignorante nn celo fatta  mi daresti una mano?? 

  9. #9
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    379
    perfavore

  10. #10
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    379
    buddy

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.