You are here: using javascript function in php function?? « PHP Programming Language « IT news, forums, messages
using javascript function in php function??

Posted by mantrid on 10/12/06 20:55

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){
document.getElementById(x).checked=true;
}
</script>


******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){
if($unedfield!==''){
echo $xtratext."<input type='text' class='BodyText' style='WIDTH:
85%' name='".$edfield."' onChange='changed(".$selquest.")>'
value='".$unedfield."'><br>" ;
}else{
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
grateful

Thank Ian

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация