Require a Page Init Javascript Function

I have a website built in NetSuite. I have also created an form in NetSuite for capturing new leads on the website. The form has a piece of code that runs when it initializes:

if ( isFocusable( document.forms['main_form'].elements['custentity_cust_5day'] ) ) { document.forms['main_form'].elements['custentity_cust_5day'].focus();document.forms['main_form'].elements['custentity_cust_5day'].select();}

Which causes the cursor to focus on the first field in the form. I have embedded this form in an I-Frame on my webpage and it caused the page to jump down to the first field in the form. To avoid this I had to plant some code in the i-frame to bring the focus back to the top of the page. You will notice that the page has a little blink in it, http://www.sightlinesconsulting.com.

Now, I am able to replace the delivered code above (if ( isFocusable( document.forms.....) with my own javacript which will run at initialization. I simply need a javascript function that does not force the focus to the first element in the custom form, but leaves the focus at the top of the page. Anyone? I am not a coder but this seems like a pretty quick little script.
tfoydelAsked:
Who is Participating?
 
RoonaanCommented:
You can try using the window.scrollTo function:
<body onload="window.scrollTo(0,0);">

-r-
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.