/    Sign up×
Community /Pin to ProfileBookmark

Alternative for onLoad

I need to trigger a function but I do not have the ability to edit the <body> tag. I wanted to use the onLoad function. What can I use that would act just like it that I can place in the middle of my HTML on the page?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@CharlesJul 25.2006 — &lt;script type="text/javascript"&gt;
onload = function () {alert ('Hello, World!')}
&lt;/script&gt;
Copy linkTweet thisAlerts:
@kpikulauthorJul 25.2006 — Thanks Charles,

Here is my issue...

Since i am using a template to render all the pages in the site, and the <head> tags are part of the template I need to have it stand alone on the page.

The template is applied to roughly 20 pages and only one page needs the redirect.

THere for if I put this in the head tags of my template it will redirect on every page.

Hope this makes sense.

&lt;script type="text/javascript"&gt;
onload = function () {alert ('Hello, World!')}
&lt;/script&gt;
[/QUOTE]
Copy linkTweet thisAlerts:
@CharlesJul 25.2006 — THere for if I put this in the head tags of my template it will redirect on every page.[/QUOTE]Then put your script in the BODY element, perhaps directly after the BODY start tag.
×

Success!

Help @kpikul 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.18,
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,
)...