简体   繁体   中英

Something better than <body onload=“javascript:showHide()”>

Guys I was wonder if I am doing something in an inefficient manner. Currently I am doing a <body onload='javascript: showHide(...etc..)'> . In the JS function I basically hide elements based on class name I gave them. But I have realized when I visit my website, just for just a short moment the elements that the JS showHide() function is intended to hide appear until the body of the page completely loads. Hopefully for my first website, intended to include in my resume, will not cost me that possible job opportunity.However, is there a better way to do what I am doing? I mean, I could just create completely dedicated pages for logged in users that are identical to the pages that non-subscribed users can view except for a few different elements; such as, links to view their account info, shopping cart, a log out link/icon, and a "logged in as: user name" display. But I thought that would be too many web pages. Anyway thanks guys for any help.

Did you think of doing it the other way around? Hide elements first and then show elements based on a class name? This way, the elements will be hidden until the body of the page is loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM