Welcome visitor
* Login
* Register
It is currently May 25th, 2019, 9:22 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  active or disable a link
PostPosted: May 2nd, 2009, 12:41 am 
User avatar

Posts: 52
hi, how can i disable a link when a checkbox is unchecked? this is what i have, i think it'll explain what i want
<input type="checkbox" name="checkbox1" id="checkbox1" /> <label for="checkbox1">I agree</label>
<a href="inside.htm">Go Inside</a>

any help is welcomed.


Top
 Profile  
 
  Re: active or disable a link
PostPosted: May 2nd, 2009, 1:57 am 
User avatar

Posts: 112
<script type="text/javascript">
function activ(box){
if (box.checked==true){document.getElementById('link').disabled=false;}
else if (box.checked==false){document.getElementById('link').disabled=true;}
}
<body onLoad="activ(checkbox1);">
<input type="checkbox" name="checkbox1" id="checkbox1" onClick="activ(checkbox1);"/> <label for="checkbox1">I agree</label>
<a href="inside.htm" id="link">Go Inside</a>


this is from the top of my head, so there might be something worng with it, hth.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron