First, give your link an id. Change this:
<a href="#'VARIABLE HERE'">click here</a>
To this:
<a href="#" id="SpinControlLink">click here</a>
Next, you'll need to change your named anchors slightly because it's not valid for names to begin with a number. They must begin with a letter. So change this:
<a name="8">
To this:
<a name="S8">
Note, I've just added an 'S' (for
SpinControl), but feel free to use whatever you like as long as it begins with a letter.
Next, assuming you've created an instance of SpinControl in variable
spinCtrl, add the following bit of JavaScript:
spinCtrl.AttachValueChangedListener(function (sender, newVal) {
// sender is the SpinControl that triggered the event
// newVal is the new value
var el = document.getElementById('SpinControlLink');
el.href = '#S' + newVal;
});
So, when the value of spinCtrl changes, the anonymous function will be called which will find your link and update the href value to be '#S8' (or whatever value was selected). Note that I've used the same prefix character 'S' as I did with the named anchors. Make sure this matches whatever you're using.