[NEWBEE] Error in function

P

paratge

Hi,

I'm trying to create a preview function and i got an error near
"IndexOf("<Script"... at the end of my function and i don't understand
why :(

Here is my code :

function Previsualise()
{
{
var VSMESSAGE="";
VSMESSAGE=_RMP(_PAGE_.SAI_MESSAGE.value,unescape("\r
\n"),unescape("<BR>\r\n"));
VSMESSAGE=_RMP(VSMESSAGE,"<SIZE=","<FONT SIZE=");
VSMESSAGE=_RMP(VSMESSAGE,"</SIZE>","</FONT>")
VSMESSAGE=_RMP(VSMESSAGE,"<COLOR=","<FONT COLOR=");
VSMESSAGE=_RMP(VSMESSAGE,"</COLOR>","</FONT>")
VSMESSAGE=_RMP(VSMESSAGE,"<QUOTE>",unescape("<TABLE width=450
border=0 bgcolor=\"#fafafa\"><TR><TD style=\"border:1px solid #cdcdcd
\"><p style=\"font-size:9pt;word-wrap:break-word\">"));
VSMESSAGE=_RMP(VSMESSAGE,"</QUOTE>","</p></TD></TR></TABLE>")
VSMESSAGE=((unescape("<span class=\"TexteBillet\"><B>Aper%E7u :</
B><BR><BR>")+VSMESSAGE)+"</span>");
var VNPOSSCRIPT=0;
VNPOSSCRIPT=(VSMESSAGE.toLowerCase().indexOf("<script")+1);
while((VNPOSSCRIPT>0))
{var VNPOSFINSCRIPT=0
VNPOSFINSCRIPT=(VSMESSAGE.toLowerCase().indexOf("</
script>",VNPOSSCRIPT-1)+1);
VSMESSAGE=(VSMESSAGE.substring(0,(VNPOSSCRIPT-1))+_MI2(VSMESSAGE,
(VNPOSFINSCRIPT+10)));
VNPOSSCRIPT=(VSMESSAGE.toLowerCase().indexOf("<script",(VNPOSSCRIPT
+1)-1)+1);
}
eval("LIBHTM_BILLET").innerHTML=VSMESSAGE;
}
}

Is there anyone to explain where i got a mistake please ?

Thanks in advance.
 
E

Erwin Moller

paratge said:
Hi,

I'm trying to create a preview function and i got an error near
"IndexOf("<Script"... at the end of my function and i don't understand
why :(

Here is my code :

function Previsualise()
{
{
var VSMESSAGE="";
VSMESSAGE=_RMP(_PAGE_.SAI_MESSAGE.value,unescape("\r
\n"),unescape("<BR>\r\n"));
VSMESSAGE=_RMP(VSMESSAGE,"<SIZE=","<FONT SIZE=");
VSMESSAGE=_RMP(VSMESSAGE,"</SIZE>","</FONT>")
VSMESSAGE=_RMP(VSMESSAGE,"<COLOR=","<FONT COLOR=");
VSMESSAGE=_RMP(VSMESSAGE,"</COLOR>","</FONT>")
VSMESSAGE=_RMP(VSMESSAGE,"<QUOTE>",unescape("<TABLE width=450
border=0 bgcolor=\"#fafafa\"><TR><TD style=\"border:1px solid #cdcdcd
\"><p style=\"font-size:9pt;word-wrap:break-word\">"));
VSMESSAGE=_RMP(VSMESSAGE,"</QUOTE>","</p></TD></TR></TABLE>")
VSMESSAGE=((unescape("<span class=\"TexteBillet\"><B>Aper%E7u :</
B><BR><BR>")+VSMESSAGE)+"</span>");
var VNPOSSCRIPT=0;
VNPOSSCRIPT=(VSMESSAGE.toLowerCase().indexOf("<script")+1);
while((VNPOSSCRIPT>0))
{var VNPOSFINSCRIPT=0

Hi,



VNPOSFINSCRIPT=(VSMESSAGE.toLowerCase().indexOf("</
script>",VNPOSSCRIPT-1)+1);

I expect your original line holds the above in 1 line.
That means the line contains </script>, which makes the javascript
parser think your script ends there.
If you must use the literal </script>, put it in a variable.
For example:
var myEndScript = "</scrip";
myEndScript += "t>";

And use the myEndScript in your line:
VNPOSFINSCRIPT=(VSMESSAGE.toLowerCase().indexOf(myEndScript
,VNPOSSCRIPT-1)+1);


Regards,
Erwin Moller
 
M

Martin Honnen

Erwin said:
I expect your original line holds the above in 1 line.
That means the line contains </script>, which makes the javascript
parser think your script ends there.
If you must use the literal </script>, put it in a variable.
For example:
var myEndScript = "</scrip";
myEndScript += "t>";

It should suffice to escape the slash e.g.
.indexOf("<\/script>",
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top