/    Sign up×
Community /Pin to ProfileBookmark

onload event

how to override onload event in this case:

<body onload=”short_script_just_used_by_this_page;common_long_script_in_all_my_pages”>

i want the common long script in external javascript so it will be like this

<script src=”externalonload.js”></script>

<body onload=”short_script_just_used_by_this_page”>

thanxx a lot

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJul 16.2003 — just put the common code in the external .js file andimport it as you have

<script src="externalonload.js"></script>

and you should be set
Copy linkTweet thisAlerts:
@roleauthorJul 17.2003 — onload in external script not called...

this is the external script:

(file externalonload.js)

<!--

onload=function() { common_long_sc

ript_in_all_my_pages() }

// -->
Copy linkTweet thisAlerts:
@CharlesJul 17.2003 — [font=georgia]We went through this once before. See http://forums.webdeveloper.com/showthread.php?s=&threadid=12929.[/font]
Copy linkTweet thisAlerts:
@roleauthorJul 17.2003 — upss ?

yeah, but still don't know the answer ?

you say the solution will be like this:


onload = function () {doSomething(); doSomethingElse()}

or

<body onload="doSomething(); doSomethingElse()">[/QUOTE]


but i want the script call the common-long-javascript

like this:

<script src="common_long.js"></script>

<body onload="page_javascript()">

no way i can do this??

thanxx
×

Success!

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