View Full Version : Need a JS programmer to execute some JS when one of my pages loads - paid
fadetoblack22
May 7th 2009, 6:06 am
I have a page on my site with some JS that performs an action when the user clicks a button. I need some help to get the action to occur on page load.
I will pay you via paypal after the job is done. Let me know and I will pm you with the page that needs the work.
I think it is done using code similar to this:
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
/* more code to run on page load */
});
koko5
May 7th 2009, 10:53 am
I've PMed you pure JS code and here is jQuery:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>loadings</title>
<script type="text/javascript" language="javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$('input[type="button"]:eq(0)').click(function(){
alert('bla');
});
$('input[type="button"]:eq(0)').trigger('click');
});
</script>
</head>
<body>
<input type="button" value="Show message bla" />
</body>
</html>
Regards
fadetoblack22
May 8th 2009, 5:43 am
Can anyone else help me with this please. Will be paid on completion of task.
JavaScriptBank.com
May 9th 2009, 6:22 pm
some JavaScript for button events maybe you need (http://javascriptbank.com/javascript/form/button/)
hiteklife
May 10th 2009, 1:03 am
Give me a PM if you'd like. Usually with scripts that run on page load, it's simplest to write a function in the head of the page, and call it at the end. For example:
<html>
<head>
<script>
function DoSomething{
//Put in code to run on page load here.
}
</script>
</head>
<body>
body text and display stuffs etc...
<script>DoSomething()</script>
</body>
</html>
That's probably the direction I'd start with. But like I say, if you need further help, I'd be glad to give it :)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.