I have some problems with Javascript. In fact, I’m just newbie in that script language so I need some help..
Q: how to make this link active:
<a href="#box1">something</a>
this link is just link to the div which is located in index.html file, so there is no loading of page.
and here is the div
<div id="box1" class="box">
<h3><a name="box1">something</a></h3>
</div>
Since you’re just starting out, I’d suggest you use a library such as jQuery. So, if your HTML is like this:
And you have a CSS class called
youarehere:With jQuery you could write something along the lines of:
In plain JS, it takes a bit more effort to achieve this. Do yourself a favor and don’t reinvent the wheel – people have already taken care of this, so use the product of their labor to make your life easier.