
October 4th, 2006, 01:05 PM
|
 |
Contributing User
|
|
Join Date: Jun 2002
Location: close to the edge
|
|
|
Scroll down after onclick event
Hi all,
I have a page that has some information in paragraph form. At the end of each type of information and paragraph there is a link that a user can click. In the past it took the user to a form lower in the page for them to fill out. I would now like it to also check a checkbox in the form based onclick.
I have that working, but I can no longer get it to scroll down on the page. So it is either one or the other, but not both. Is there a way I can have my cake and eat it too?
Here is some code tidbits so you can see what I am doing:
Code:
// a link
<a href="#scrollDown" onclick="return checkTheBox('hot');" class="float_link">Subscribe Now…</a>
// javascript
function checkTheBox(vl) {
var el = document.subscribeForm.lid;
switch(vl) {
case 'hot':
el[0].checked = true;
break;
case 'spotlight':
el[1].checked = true;
break;
case 'bell':
el[2].checked = true;
break;
case 'today':
el[3].checked = true;
break;
case 'fx':
el[4].checked = true;
break;
}
return false; // have tried true here also
}
// the form (part of it)
<form action=" " name="subscribeForm" method="post" onSubmit="return checkForm();">
<p>I Wish to Receive (please check all desired boxes):</p>
<label for="lid1">Hot Futures Market:</label><input class="tipInput" type="checkbox" name="lid" id="lid1" value="582505" />
<label for="lid2">Daily Futures Spotlight:</label><input class="tipInput" type="checkbox" name="lid" id="lid2" value="529884" />
<br class="left" />
<label for="lid3">Futures Closing Bell:</label><input class="tipInput" type="checkbox" name="lid" id="lid3" value="529886" />
</fieldset>
</form>
<a name="scrollDown"></a>
Thank you for your time and help,
cranium
|