/    Sign up×
Community /Pin to ProfileBookmark

Javascript "onLoad= "

Hi

I have a problem with a javascript function link to <body onLoad=” “>.
I simply got no response at all. Bearing in mind, I am working with microsoft window environment.
Thank you for your help in this matter.

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@CharlesAug 15.2006 — Please bear in your own mind that you have given us very little to go on, no real description of the problem and no example of what you have tried. I'm afraid there's not much that we can do to help.
Copy linkTweet thisAlerts:
@phd40authorAug 17.2006 — Hi,

Thank you very much for your prompt response.

I would like to explain my problem with the following example:

<html>

<head>

<script type="text/javascript">

function load()

{

window.status="Page is loaded"

}

</script>

</head><body onload="load()">

</body></html> (i.e I quoted this simple example from www.w3schools.com/jsref_onload.asp)

Unfortunately, When I implemented the above example into my web site , simply did not work.

Thank you for your help in this matter.
Copy linkTweet thisAlerts:
@tabzterAug 17.2006 — have you confirmed that javascript is enabled in that particular browser?

Does it work in other browsers?

I dont see nothing wrong with that code (apart from a missing semi-colon -- but thats no bother). Maybe the load() function is a reserved word or something. Hopefully some1 will confirm.
Copy linkTweet thisAlerts:
@RobDavidAug 17.2006 — load from my knowledge isn't a reserved keyword....It has to be something with your browser!
Copy linkTweet thisAlerts:
@hansschmuckerAug 17.2006 — The reason why the sample doesn't work might be something entirely different, namely that statusbar changes are forbidden in most modern browsers... try it with something like an alert... that should work.
Copy linkTweet thisAlerts:
@JavaKid93Aug 17.2006 — <body onload=" ">
Copy linkTweet thisAlerts:
@JavaKid93Aug 17.2006 — not <body onLoad=" ">
Copy linkTweet thisAlerts:
@felgallAug 17.2006 — Actually that should be window.onload=load; in the Javascript and <body> in the HTML.

If you do use the deprecated onload= in the body then capitalization doesn't matter because HTML is not case sensitive. If you put it in the Javascript then it must be all lowercase because Javascript is case sensitive.
×

Success!

Help @phd40 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...