[thelist] JavaScript to jump to the top of a page

Damien COLA damiencola at wanadoo.fr
Tue Dec 23 09:21:14 CST 2003


Hi Sarah, you already got a good answer, but here's another :

what I do is simply disable (looks greyish and can't be clicked) the
submit/save button once it's been clicked, and also change the text of
the button to something like : Please wait.

here's a fnuction to disable buttons nammed submit or reset :

function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and
"reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="re
set")
//disable em
tempobj.disabled=true
}
}
}

and in your form tag you do : onSubmit="submitonce(this)"

it's cleaner, and uses javascript too, like you do, so you know... in
both cases users without javascript can go see elsewhere or activate
javascript back, it's as they wish/can.

-----Original Message-----
I tried:
   document.location = '#top';
but that didn't work. Does anyone have an idea of how to do this?



More information about the thelist mailing list