using javascript function in php function??


Can anyone see why the checkbox in the code below doesnt get ticked when the
textbox is changed

***This javascript function is called in the textbox's onchange event to
check it when it is changed*****

<script type="text/JavaScript">
function changed(x){

******This php function determine whether the check box is shown or not
(actually does more than this but ive slimed down the code) and has the
javascript function in the onChange event of the echoed textbox

function editable($edfield,$unedfield,$xtratext,$selquest){
           echo $xtratext."<input type='text' class='BodyText' style='WIDTH:
85%' name='".$edfield."' onChange='changed(".$selquest.")>'
value='".$unedfield."'><br>" ;
          echo '';

************The code below displays the check box to be ticked and the text
box (or blank) fron the execution of the php function (editable)*********

<input name="changed[]" type="checkbox" id="<?php echo $QuestionIndex; ?>"
value="<?php echo $QuestionIndex; ?>">
<?php editable($groupcount,'question',$Question,1,'') ?>

I suspect it could be due to using a javascript function in php function.
I'm not sure if this is allowed. If anyone can see what wrong Id be very

Thank Ian                                            
JavaScript and PHP have *nothing* to do with one another.
(Read this three times so that you
understand it.)

PHP produces X/HTML. The web browser sees that code. Now JavaScript
comes into play.

View Source on your web page to see what code is actually coming out,
and then you will see why your HTML may or may not be broken. That's
all the browser cares about.
You may also want to use Mozilla's Web Developer Toolbar, it's very
helpful in debuging JavaScript code.

Hope this helps.