SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question single quote problems

    Hi there,

    im trying to put a new message into a textarea object
    i mean im trying to concatenate 2 strings but the problem is that strings have single quotes.

    For example

    JAVASCRIPT CODE
    function ARes(Dest, Mess)
    {
    Tmp = Dest.value
    Tmp2 = Dest.name
    Tmp1 = Mess

    if (Tmp != '')
    eval("document.forms.Prueba."+Tmp2+".value ='"+Tmp+" and "+Tmp1+"'")
    }

    HTML CODE
    <form method ........>
    <textarea type=text cols=40 rows=8 name="Res" value=''> </textarea>
    <input type=button name=M value=PastMonth onClick="ARes(Res, "Fecha_Captura>='2002-01-01' and Fecha_Captura<='2002-01-31'")"

    if i put this on html not works because the "
    but i need the ' after Fecha_Captura>=

    how can i do to include ' without problem?
    Thanks a lot
    and Happy New Year!!!!
    Tom

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    don't use eval

    function ARes(Dest, Mess)
    {
    Dest.value += " and " + Mess;
    }

    <input type=button name=M value=PastMonth onClick="ARes(this.form.Res, 'Fecha_Captura>=\'2002-01-01\' and Fecha_Captura<=\'2002-01-31\';">
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank u so much

    Its really worked

    im inside of PHP and put this

    printf("<input class=butPag type=button name=MesPasado value=MesPasado onClick=\"AgregaRestricciones(Restricciones, 'Fecha_Captura>=\'%s\' and Fecha_Captura<=\'%s\'')\">", $RowF[0], $RowF[1]);

    Thanks a lot eeeh.
    Greetings


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •