0

ReferenceError:something_anything_nothing is not defined エラーが発生しています...助けてください。

    <script>
    function show(str)
    {
    var r=str;
    alert(r);
    }
    </script>


    <?php
    $l='something_nothing_anything';
    echo "<select onChange='show($l)'>";
     echo "<option></option>";
       echo "</select>";
      ?>
4

2 に答える 2

0
$l='Somethin_nothin_anythin'; 
$buffer="<select onchange='show(\'".$l."\')'>"; 
$buffer.= "<option></option>"; 
$buffer.="</select>";
echo $buffer;

Try this

于 2013-10-27T12:58:57.857 に答える
0

You probably need to wrap the value in $l in quotes, like this:

$l='"something_nothing_anything"';
于 2013-10-27T12:59:03.773 に答える