Click to See Complete Forum and Search --> : a JavaScript function that sets the home page


Salam
04-29-2003, 12:49 AM
Hi, I need a JavaScript function that makes a URL the home page to include on my site

Salam

DrDaMour
04-29-2003, 01:59 AM
http://forums.webdeveloper.com/showthread.php?s=&threadid=8100&highlight=homepage


see that post.

Salam
04-29-2003, 03:16 AM
Hi, I looked at the code in that URL but I do not seem to understand. Should something like this work ?

function makeHomePage()
{
this.setHomePage('http://www.mypage.com');
}

DrDaMour
04-29-2003, 04:07 AM
no:



<html>
<script>
<!--
function addto()
{

var url = prompt("What is the URL?","http://")
var title = prompt("What is the Title",url)

window.external.AddFavorite(url,title);

return url;

}
//-->
</script>


<input type="button" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage(addto());">


</html>

Salam
04-29-2003, 05:35 AM
Hi, sounds good ... considering that I do not need the "add to favoriets" part and do not need user input for the URL, that code is equivelent to the following (and it worked):

<html>

<input type="button" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://my-page.com');">

</html>

Now the problem is that this is not in a Javascript function. I have a special kind of a menu from which I can call a javascript function but I can't use html code directly in the menu. So is there a way to put the above code in a JavaScript function ? Sure I do not need to display the button and on click in this case.

Thanks
Salam