Visualizzazione dei risultati da 1 a 8 su 8

Discussione: Segnala ad un amico

  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    48

    Segnala ad un amico

    Ciao a tutti, sto cercando di sistemare nelle mie pagine uno script che ho trovato nella rete (http://www.codetoad.com/asp/tell_a_friend.asp); quello che vorrei fare è includere lo script nel footer.asp in modo che il link di "segnala questa pagina ad un amico" compaia in tutto il sito e quindi in tutte le pagine.

    Il codice che ho trovato sembra avere dei problemi; in particolare l'url da cliccare è errato (compare ")) e anche quando sono riuscito ad aprire la pagina di invio, pur arrivando mi la mail non mi mette l'url corretta della pagina da cui proviene; lo posto qui, qualcuno mi può aiutare? Grazie.


    Questo è il codice che ho inserito nel footer.asp e che richiama la pagina 'tell_a_friend_script.asp


    <html>

    <head>
    <script language="javascript">
    function TellFriend(ref)
    {
    var str="toolbar=no,status=no,menubar=no,location=no,s crollbars=yes,resizable=yes,height=320,width=500"
    tellaFriend = window.open(ref,"TellObj",str);
    tellaFriend.opener = top;
    }

    </script>
    <title>Tell a friend about this page</title>
    </head>

    <body>

    ')">Tell a friend about this page!




    </p>

    </body>

    </html>



    Questa invece è la pagina 'tell_a_friend_script.asp



    <HTML>
    <HEAD>
    <TITLE>codetoad.com: Tell a Friend</TITLE>




    <%



    page=""
    qs=Request.ServerVariables("query_string")
    if len(qs)>0 then
    page=right(qs, len(qs)-5)
    end if

    if page="" then
    page=Request.form("page")
    if page="" then
    Response.Write "Error1"
    Response.End
    end if
    end if

    if Request.Form("fromEmail")="" then
    showForm
    else
    sendEmail
    end if


    sub showForm


    %>

    <HTML>
    <HEAD>
    <TITLE>Codetoad.com: Tell a Friend</TITLE>




    <script language="JavaScript">
    <!--
    window.focus();
    // -->
    </script>
    </HEAD>
    <body bgcolor="#FFFFFF" link="#003399"
    alink="#FF3366" vlink="#003399" text="#000000">

    <table border=0 cellpadding=5 cellspacing=5 width=95% >
    <tr>
    <td valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#99ccff">
    <tr>
    <td><font face="verdana, arial"
    size="2"> Tell a Friend</font></td>
    </tr>
    <tr>
    <td>
    <table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor="#ffffff">
    <tr>
    <td valign="top">
    <font face="verdana, arial" size="1">
    Use the form below to send your
    friend an e-mail telling them about this page
    (we do not store
    the email addresses and will never
    contact you using email addresses entered only in tell-a-friend)
    </font></td>
    </tr>
    <TR>
    <td>
    <table border=0 cellpadding=0 cellspacing=0>
    <TR>
    <td align="left">
    <form action="tell_a_friend_script.asp" method="POST">
    <font face="verdana, arial" size="2">
    <nobr>Your e-mail: </nobr>
    </font></td>
    <td align="left">
    <input type="Text" name="fromEmail"
    value="" size="32" maxlength="255">
    </TD>
    </tr>
    <TR>
    <td align="left">
    <font face="verdana, arial" size="2">
    <nobr>Your friend's e-mail: </nobr>
    </font></td>
    <td align="left">
    <input type="Text" name="toEmail"
    value="" size="32" maxlength="255">
    </TD>

    </tr>
    <TR>
    <td align="left" valign=top>
    <font face="verdana, arial" size="2">
    <nobr>Additional Message: </nobr>
    </font></td>
    <td align="left">
    <textarea name=message maxlength=500
    cols=24 rows=5></textarea>

    </td>
    </tr>
    <TR><td height="5" colspan="2"></td></tr>
    <TR>
    <td></td>
    <td align="left" valign="top">
    <input type="hidden" name="page" value="<%=page%>">

    <input type="Submit" value="Send It"></td></tr>
    </table></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </form>




    </BODY>
    </HTML>
    <%


    end sub



    sub sendEmail


    fromEmail=Request.Form("fromEmail")
    toEmail=Request.Form("toEmail")
    message=Request.Form("message")
    page=Request.Form("page")

    Dim objNewMail

    Set objNewMail = Server.CreateObject("CDONTS.NewMail")
    objNewMail.From = fromEmail
    objNewMail.To = toEmail

    objNewMail.Subject = "Ti segnalo questa pagina"
    strBody = "Hi,"&Vbcrlf&Vbcrlf
    strBody=strBody & fromEmail &" asked us to forward a message to you because "
    strBody=strBody & "they thought you might be interested in the following free "
    strBody=strBody & "script tutorial at Codetoad.com: "&vbcrlf&vbcrlf&page&vbcrlf&vbcrlf
    strBody=strBody&"_________________________________ _________"&vbcrlf&Vbcrlf
    strBody=strBody& fromEmail & " wrote : " &vbcrlf&Vbcrlf
    strBody=strBody&message&vbcrlf&vbcrlf
    strBody=strBody&"_________________________________ _________"&vbcrlf
    strBody=strBody&"codetoad.com"&vbcrlf
    strBody=strBody&"http://www.codetoad.com"
    objNewMail.Body=strBody
    objNewMail.Send
    Set objNewMail = Nothing



    %>

    <html>
    <body bgcolor="#FFFFFF" link="#003399"
    alink="#FF3366" vlink="#003399" text="#000000">

    <table border=0 cellpadding=5 cellspacing=5 width=95% >
    <tr>
    <td valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#99ccff">
    <tr>
    <td><font face="verdana, arial" size="2">
    Tell a Friend
    </font></td>
    </tr>
    <tr>
    <td>
    <table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor="#ffffff">
    <tr>
    <td align="left" valign=top>
    <font face="verdana, arial, helvetica" SIZE="2">
    Thanks! An e-mail has been sent to <%=toEmail%>
    telling them about this page. We appreciate
    you taking the time to help spread the word
    about Codetoad.com.



    Note: This message is not a guarantee of delivery.



    Close this window
    </font></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>




    </BODY>
    </HTML>

    <%


    end sub%>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Cioè nel footer hai rimesso tutti i tag html???

    Roby

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    48
    Nel footer ho messo:



    <script language="javascript">
    function TellFriend(ref)
    {
    var str="toolbar=no,status=no,menubar=no,location=no,s crollbars=yes,resizable=yes,height=320,width=500"
    tellaFriend = window.open(ref,"TellObj",str);
    tellaFriend.opener = top;
    }

    </script>


    e il codice:

    <a href="javascript:TellFriend('http://www.codetoad.com/asp/tell_a_friend_script.asp?page=<%
    Response.write server.URLEncode("http://www.codetoad.com/asp/tell_a_friend.asp")
    %>')">Tell a friend about this page!</a>


    è proprio quest'ultimo che mi da problemi e che vorrei che memorizzasse ed inviasse l'url della pagina da cui parte.

    Grazie.

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Devi usare le servervariables:
    http://www.w3schools.com/asp/coll_servervariables.asp

    script_name ad esempio.

    Roby

  5. #5

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Ragiona...
    La server_name cosa riporta? Il nome della pagina???

    Roby

  7. #7
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    48
    Scusa, intendevo:



    <a href="javascript:TellFriend('tell_a_friend_script. asp?page=<%Response.Write
    (Request.ServerVariables("script_name"))%>')">Tell a friend about this page!</a></p>


    come avrai capito non sono molto pratico di codice...

    in ogni caso, anche se il codice fosse corretto, mi scrive sulla pagina:

    ')">Tell a friend about this page!

    cioè con ')"> che mi pare non ci debba stare (è un rrore che si porta dietro dal codice dello script originale che ho trovato nel sito indicato...)

    Grazie

  8. #8
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    48
    Niente da fare non vuole andare.

    Qualcuno conosce qualche altro script simile ma funzionante?

    Grazie

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.