![]() |
|
|
|
|
|||||||
| Javascript / Java Applets Are you a JavaScript guy? Do you need help with JavaScript? This is the place to talk about anything related to Java. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I'm trying to write a function in a page of my web hosting that should do the following: to gather information about all links that are in the div tag and when the visitor select a checkbox from my website these links to be disabled. Any help would be welcome. |
|
#2
|
||||
|
||||
|
I guess that will be helpful. Connect to your hosting account and add this code into the page.
HTML Code:
<div id="someID"> <input type="checkbox" onclick="disable_elements(this, 'someID')" checked> <a href="1">1</a> <a href="1">2</a> <a href="1">3</a> <a href="1">4</a> </div> <script language="JavaScript"> <!-- function disable_elements(cb, id) { var div_links = document.getElementById(id).getElementsByTagName("a"); for(var i=0; i<div_links.length; i++) { div_links[i].disabled = !cb.checked; div_links[i].onclick = cb.checked ? function () {return true;} : function() {return false;}; } } //--> </script> |
![]() |
| Tags |
| function, hosting, page, web |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|