...

View Full Version : Browser Home Page



Dingbat
12-03-2009, 10:15 AM
Hi Guys

Is it possible to combine the following to bits of code. The first code will send the user to the browser home page if using IE.

Code:[[a href="about:home">home</a>]]

The second code will send the user to the browser home page if using Firfox.

Code:[[input type="button" onclick="if (window.home) window.home()" value="Home">]]

Both codes work in their respective browsers, but can they be combind.

As the man from Tesco's says "Every little helps".

Regards,

Dingbat :confused:

Philip M
12-03-2009, 12:17 PM
Here you are:-


<input type="button" onclick="goHome()" value = "Home">

<script type = "text/javascript">
function goHome() {
if (document.all) { // IE
window.location = "about:home";
}
if (window.home) {window.home()} // Firefox and Opera
}

</script>

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

Dingbat
12-03-2009, 12:24 PM
Hi Phillip M,

Thanks for the reply, it worked just fine.

Regards,

Dingbat. :D:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum