<input id="aaa" onclick="scrollTo('registerBox'); return false;" formaction="register.php" type="submit" value="Register" />

If JavaScript is enabled (which it is, and it's working on other functions and triggers). Shouldn't it execute scrollTo("registerBox"); and don't do anything (return false;).
Am I missing something? I don't want it to formaction if JavaScript is enabled.

Member Avatar for pasta

There you go now type in the body area this not in the script tags
make a function that returns ot not just a button i know you returned false and that might be why and also i did not heard of formaction ( i am learning JavaScript)

     <input onClick=" return 'Hey!'" formaction="register.php" type="submit" value="Register"/>

Sorry, but your snippet returns 'Hey!', I don't need it to return anything, I need it to execute mentioned function and return nothing.
That answer doesn't bring me closer to expectations.

And without punctionation and seperation it's hard to get by what you mean with "There you go now type in the body area this not in the script tags make a function that returns ot not just a button i know you returned false and that might be why".

For starter I'd recommend to take out the onclick attribute from the HTML. Keep structure and behavior seperate.

<input id="aaa" formaction="register.php" type="submit" value="Register" />

And then within <script> tags

document.getElementById('aaa').addEventListener('click', function (e) {
    e.preventDefault();
    // scrollTo here
});

or with jQuery

$('#aaa').on('click', function (e) {
    e.preventDefault()
    // scrollTo here
})
commented: Agreed +15
commented: I guess it's better practice, than to skip back and forth. +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.