am new to coding in javascript and am presently working on a web page where i have some anchor tags in the left navigation bar and onclick of those links, i want to modify the content of a division named content!
the code im using is as follows
for($i=0;$i”.mysql_result($cat,$i,0).”
“;
}
am grabbing the categories from my database and generating links for each of them.
function phpload(clicked) {
if(clicked.name==’php’) { alert(‘hello’);
document.getElementsByClassName(‘content’).innerHTML=’hello
php‘;
}}
and my page i.e the content division is as follows!
> <section class="content">
>
> </section>
Do you have more than one div you want to modify? If not, you should use id and not class. Class is for changing multiple elements at the same time. Try something like this:
div:
Button:
Script: