I have problem trying to convert VBScrip to JS

I am trying to convert this from VBS to JS, but I have problems and do not find de correct way:

  rw "<SCRIPT LANGUAGE='VbScript'>"
  rw "tmp.pantallazo.value=replace (DamePP(),chr(13) + chr(10),""|"")" & chr(13) & chr(10)
  rw "document.forms.tmp.submit()"& chr(13) & chr(10)
  rw "</SCRIPT>"

My proposal is:

  rw "<script language='JavaScript'>"
  rw "var str = DamePP();"
  rw "document.getElementById('pantallazo').value = str.replace('rn','|') + rn;"
  rw "document.tmp.submit();"               
  rw "</script>"            

Thanks

Any idea?