Forum Moderators: open
<input id="wpSave" name="wpSave" type="submit" tabindex="5" value="Save page" accesskey="s" title="Save your changes [s]" />
Unfortunatly I can't edit this, but I would like to have javascript run a simple function if the button is clicked.
onClick="javascript: pageTracker._trackPageview('/outgoing/example.com');"
How can I have my script watch that button to run the script if someone clicks on it?
Thanks
Unfortunately I can't edit this,
But you have access to the page template that contains it? See if you can attach a behavior onload. Untested, as I don't know the nature of "pageTracker":
<script type="text/javascript">
window.onload=function() { setTracker(); };
function setTracker() {
if (document.getElementById('wpSave')) {
document.getElementById('wpSave').onclick=function() {
pageTracker._trackPageview('/outgoing/example.com');
};
}
}
</script>