/    Sign up×
Community /Pin to ProfileBookmark

Question with this script

Howdy~
I have the following external script, that I am trying to find out how I can have a page load up instead of having to click on a link first to get the page to show up.

[code]
var please_wait = null;

function open_url(url, target) {
if ( ! document.getElementById) {
return false;
}

if (please_wait != null) {
document.getElementById(target).innerHTML = please_wait;
}

if (window.ActiveXObject) {
link = new ActiveXObject(“Microsoft.XMLHTTP”);
} else if (window.XMLHttpRequest) {
link = new XMLHttpRequest();
}

if (link == undefined) {
return false;
}
link.onreadystatechange = function() { response(url, target); }
link.open(“GET”, url, true);
link.send(null);
}

function response(url, target) {
if (link.readyState == 4) {
document.getElementById(target).innerHTML = (link.status == 200) ? link.responseText : “Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the fallowing errorcode: ” + link.status;
}
}

function set_loading_message(msg) {
please_wait = msg;
}[/code]

Thanks
The Devil

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KorJul 30.2006 — onload=function(){open_url('yourpage.php','yourtarget')}
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJul 30.2006 — Where would I locate that in the html?

Thanks

The Devil
Copy linkTweet thisAlerts:
@KorJul 31.2006 — Where would I locate that in the html?

Thanks

The Devil[/QUOTE]

Not in the HTML, in the javascript code. Anywhere. Usualy at the very end of the code, or at the very start of the code (only to be easy seen, in case you might need later to trigger another function onload)
×

Success!

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