and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
ok I know i have been on this like all day and i want to thank every one that had help me
I just need a couple more things
I have a function that is working fine when i press a link I want the same function to run on unload but i am not sure that i am passing the proper parameters or doing it courtly
My first function:
This initializes the actions
[syntax="javascript"]
window.onload = initializeClicks;
// Run whenthe page is about to close
function initializeClicks()
{
if (document.links)
{
var oldClick = (document.links[0].onclick) ? document.links[0].onclick : function() {};
document.links[0].onclick = function() { doClick(); oldClick(); }
document.links[0].onmousedown=alertBut
for (var i = 1; i < document.links.length; i++)
{
var oldClickLoop = (document.links[i].onclick) ? document.links[i].onclick : function() {};
document.links[i].onmousedown=alertBut;
}
}
}
function alertBut( e, evElement ) {
if( !e ) {
if( window.event ) {
//Internet Explorer
e = window.event;
} else {
//total failure, we have no way of referencing the event
return;
}
}
//Netscape compatible
if( typeof( e.which ) == 'number' ) {
e = e.which;
} else if( typeof( e.button ) == 'number' ) {
//DOM
e = e.button;
} else {
//total failure, we have no way of obtaining the button
return;
}
if( !evElement )
{ evElement = this; }
var st = evElement + ""; //converts the full address to a string
split_evElement = st.split("/"); // divides the string were ever it finds a /
var domainname=split_evElement[2] // get's the 3rd element of the array http://www.domainname.com
if (domainname=='1192.LocalServer.com' || domainname=='www.yahoo.com' || domainname=='www.moiseszaragoza.com' || domainname=='www.artofthetime.com'){
self.location.href=evElement
// goes to the page it has to go
}else{
// window.alert(domainname)
//window.alert(evElement)
window.open("survey.asp");
// opens a new window
self.location.href=evElement
// goes to the page it has to go
}
}
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
ok I know i have been on this like all day and i want to thank every one that had help me
I just need a couple more things
I have a function that is working fine when i press a link I want the same function to run on unload but i am not sure that i am passing the proper parameters or doing it courtly
My first function:
This initializes the actions
[syntax="javascript"]
window.onload = initializeClicks;
// Run whenthe page is about to close
function initializeClicks()
{
if (document.links)
{
var oldClick = (document.links[0].onclick) ? document.links[0].onclick : function() {};
document.links[0].onclick = function() { doClick(); oldClick(); }
document.links[0].onmousedown=alertBut
for (var i = 1; i < document.links.length; i++)
{
var oldClickLoop = (document.links[i].onclick) ? document.links[i].onclick : function() {};
document.links[i].onmousedown=alertBut;
}
}
}
function alertBut( e, evElement ) {
if( !e ) {
if( window.event ) {
//Internet Explorer
e = window.event;
} else {
//total failure, we have no way of referencing the event
return;
}
}
//Netscape compatible
if( typeof( e.which ) == 'number' ) {
e = e.which;
} else if( typeof( e.button ) == 'number' ) {
//DOM
e = e.button;
} else {
//total failure, we have no way of obtaining the button
return;
}
if( !evElement )
{ evElement = this; }
var st = evElement + ""; //converts the full address to a string
split_evElement = st.split("/"); // divides the string were ever it finds a /
var domainname=split_evElement[2] // get's the 3rd element of the array http://www.domainname.com
if (domainname=='1192.LocalServer.com' || domainname=='www.yahoo.com' || domainname=='www.moiseszaragoza.com' || domainname=='www.artofthetime.com'){
self.location.href=evElement
// goes to the page it has to go
}else{
// window.alert(domainname)
//window.alert(evElement)
window.open("survey.asp");
// opens a new window
self.location.href=evElement
// goes to the page it has to go
}
}
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color][/quote]
I think you need to do [b]<body onUnload=alertBut(false, false)>[/b] or fill in the variables for the function.