Toon posts:

{JS/ASP] Unterminated String constant

Pagina: 1
Acties:

Verwijderd

Topicstarter
Weet iemand hoe ik het best alle [returns] uit een ASP.string kan halen, zodat ik deze ASP.string kan afdrukken met een javascript.alert

Ik krijg de foutmelding doordat de alert over meerdere regels verspreidt wordt door de ASP server.

vb:
code:
1
2
3
4
5
str = "<regel1>
     <regel2>
     <regel3>"

Response.write ("<script> alert(""" & str & """); </script>")

geeft een unterminated string constant.

want de output wordt:
code:
1
2
3
<script> alert("<regel1>
            <regel2>
            <regel3>");</script>

:'(

  • Guillome
  • Registratie: Januari 2001
  • Niet online

Guillome

test

replace "chr(13)&chr(10)" met "\n" ??

If then else matters! - I5 12600KF, Asus Tuf GT501, Gigabyte Gaming OC 16G 5080 RTX, Asus Tuf Gaming H670 Pro, 48GB, Corsair RM850X PSU, SN850 1TB, Arctic Liquid Freezer 280, ASUS RT-AX1800U router


Verwijderd

Topicstarter
Hmm,

Replace chr(13) werkt niet zo goed. Hij zet gewoon de "\n" voor chr(13) ik heb nu dit:
code:
1
2
3
<script>alert("<regel1>\n
           <regel2>\n
           <regel3>");</script>\n

:?

  • Guillome
  • Registratie: Januari 2001
  • Niet online

Guillome

test

Misschien heb je hier wat aan ( Het is een JavaScript, niet PHP hoor!!!
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?
  function gotowebsite()
  {
    Fout = 0; geslacht = "";
    if (document.form1.man.checked) { geslacht = "man"; }
    else if (document.form1.vrouw.checked) { geslacht = "vrouw"; }
    Msg = "Er zijn een aantal dingen niet ingevuld. Het betreft:";
    if (document.form1.naam.value == '') { Msg = Msg + '\n* Je (voor)naam'; Fout = Fout + 1; }
    if ((document.form1.naam.value.length) <= 2) { Msg = Msg + ' ( of de naam is te kort )'; Fout = Fout + 1; }
    if (document.form1.anaam.value == '') { Msg = Msg + '\n* Je achternaam'; Fout = Fout + 1; }
    if (document.form1.gjaar.value == '') { Msg = Msg + '\n* Je geboortejaar'; Fout = Fout + 1; }
    if (geslacht == '') { Msg = Msg + '\n* Je geslacht'; Fout = Fout + 1; }
    if (Fout > 0) { alert(Msg); } else { form1.submit();}
  }
?>

If then else matters! - I5 12600KF, Asus Tuf GT501, Gigabyte Gaming OC 16G 5080 RTX, Asus Tuf Gaming H670 Pro, 48GB, Corsair RM850X PSU, SN850 1TB, Arctic Liquid Freezer 280, ASUS RT-AX1800U router


Verwijderd

Topicstarter
Bedankt XLerator!!

Het werkt nu
chr(10) was toch welke ik moest replacen...
:+