News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

javascript help

Started by Thunderace, June 12, 2005, 05:28:07 AM

Previous topic - Next topic

Thunderace

The following works fine in html

<script>replaceTextarea(
            'contents'                  //textarea id
            , '100%'                   //width
            , '200px'                   //height
            ,'/rich-textarea-53'        //html directory
            ,'/rich-textarea-53.css'                //style sheet file
            )</script>


However when using echo ' it throws up errors

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'

This error is for everything within ' '

any ideas please?

Saleh

#1
is your script like this:

echo '<script>replaceTextarea(
            '
contents'                  //textarea id
            , '
100%'                   //width
            , '
200px'                   //height
            ,'
/rich-textarea-53'        //html directory
            ,'
/rich-textarea-53.css'                //style sheet file
            )</script>'
;

?
you will have to use double quotes for either your echo or javascript's arguments.


echo "<script>replaceTextarea(
            'contents'                  //textarea id
            , '100%'                   //width
            , '200px'                   //height
            ,'/rich-textarea-53'        //html directory
            ,'/rich-textarea-53.css'                //style sheet file
            )</script>"
;

We don't need a reason to help people


Saleh

well of course, that's another solution ;D

We don't need a reason to help people

Advertisement: