PDA

View Full Version : Can two javascripts be combined



buzzy1
05-01-2008, 02:51 PM
Hi,
Not sure if this can be done or not, but here is what I would like to have happen.

I've got two javascript functions that I need combined in one button. Here is the page I need it to happen on: http://knowledgebase.acstechnologies.com/pf/12/webfiles/general%20images/contact_kb_admins.htm


----------------
function emailSupport()
{
window.location="http://apps.acstechnologies.com/support/emailsupport/acsemailform.asp";
}
----------------

and


----------------
var browserName=navigator.appName;
if (browserName=="Netscape") {

function closynoshowsme()
{
window.opener='X';
window.open('','_parent','');
window.close();}
}
else {
if (browserName=="Microsoft Internet Explorer")
{
function closynoshowsme()
{
window.opener = "whocares";
window.close();
}
}
}
----------------

What I want to have happen is once the user clicks Email Support, the window with the two buttons closes and a new window opens going to the Email Support Page. I'd also like to have it where when the user clicks Email Admins, that it opens a new email from their email client, then the small window closes.

Can anyone help with this?

Oh, I haven't posted in a very long time, so consider me a newbie.

Thanks.

---
Brandon

buzzy1
05-01-2008, 03:07 PM
I was able to figure it out. Feel free to check out the finished page at http://knowledgebase.acstechnologies.com.

Scroll to the bottom and click Contact Knowledge Base Administrators.

Thanks!

-Brandon

jscheuer1
05-01-2008, 03:14 PM
I will not vouch for the efficacy of your code or the wisdom of what you are trying to do.

That said, just about anything can be combined in javascript, more so something as uncomplicated as these two bits of code:


var browserName=navigator.appName;
if (browserName=="Netscape") {

function closynoshowsme()
{
window.opener='X';
window.open('','_parent','');
window.close();}
}
else {
if (browserName=="Microsoft Internet Explorer")
{
function closynoshowsme()
{
window.opener = "whocares";
window.close();
}
}
}

function emailSupport()
{
window.location="http://apps.acstechnologies.com/support/emailsupport/acsemailform.asp";
closynoshowsme();
}

Note: As I say, I can't guarantee that it will work. They will only be as good together, as the two were separately to begin with.