Problems with a button in PHP Code

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Wed Jul 03, 2013 11:19 am

Problems with a button in PHP Code

Postby asanrod » Wed Jul 03, 2013 11:23 am

I have the following button
<td><input type="button" name="clear" value="clear" onClick="clearAllRadios()" /></td>

And the script embedded in <head> </head>

<script language="JavaScript" type="text/javascript">
function clearAllRadios( name ) {
alert( "clearAllRadios );
var radList = document.getElementsByName(name);
for (var i = 0; i < radList.length; i++) {
if(radList[i].checked) document.getElementById(radList[i].id).checked = false;

Id doesn't responde to the click button, please help me with some indication.

php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Problems with a button in PHP Code

Postby johnj » Tue Jul 09, 2013 12:04 am

your function is expecting a parameter. so change onClick="clearAllRadios() to onClick="clearAllRadios('Hello')

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 9 guests