Set As Homepage Help!!! URGENT!
-
- Beginner
- Posts: 5
- Joined: Fri Jan 14, 2005 4:51 am
- Contact:
Set As Homepage Help!!! URGENT!
Does anyone know how to set a link to set as homepage? This is what I have found, but need help setting up. I have my menu written in javascript, go to http://www.fbc-lc.org and view source to see what I'm saying...
This is waht I fould: (But where do i put this?)
function doSomething( vThis )
{
vThis.style.behavior="url(#default#homepage)";
vThis.setHomePage("http://www.fbc-lc.org");
}
And for my menu link:
///new menu item(){ blah blah...
...
...
aI("text=Set as Homepage;url=javascript:doSomething(this);");
...}
This is waht I fould: (But where do i put this?)
function doSomething( vThis )
{
vThis.style.behavior="url(#default#homepage)";
vThis.setHomePage("http://www.fbc-lc.org");
}
And for my menu link:
///new menu item(){ blah blah...
...
...
aI("text=Set as Homepage;url=javascript:doSomething(this);");
...}
- fredlongworthhighschool
- Mega Advanced
- Posts: 362
- Joined: Fri Jun 27, 2003 11:34 am
- Location: Manchester, England.
- Contact:
-
- Beginner
- Posts: 5
- Joined: Fri Jan 14, 2005 4:51 am
- Contact:
- fredlongworthhighschool
- Mega Advanced
- Posts: 362
- Joined: Fri Jun 27, 2003 11:34 am
- Location: Manchester, England.
- Contact:
Hi Dustin,
Once you add the curly brace, you may still get a permission denied error when testing the function locally (i.e., loading a test page directly from your hard drive then clicking the menu item will generate the "permission denied" error and the function won't work ). But if you upload the page to a webserver, and load the page through http, then it should work just fine, opening the "Add Favorite" dialog. Note that the function uses document.title, so your pages should have the title attribute set in order for the added favorite to have a description. If you don't have a title in your pages, holler and I can post an alternative method.
Defining a menu item that lets you "set this page as your home page" is a little more involved. The method you came across (code you posted) looks like it's meant to be called from an onclick handler in a static link; it probably will not work in a menu item. But I think it could still be done, with a slightly different approach. If you're still interested in trying that, let us know and we'll whip something up.
Cheers,
Kevin
The function that Andy Posted in your other, related thread, for adding the page to Favorites (bookmarking), actually does work (BTW, thanks for jumping in and helping Andy!). But in his eagerness to help, it looks like Andy left out the closing curly brace } at the bottom of the function definition. If you tried to run the page with the function like that, you probably would have gotten a "Done but with errors on page" message, and the main menu probably would not have shown up at all. Easy to fix... Just add a } at the bottom of the function definition, and it should work fine.acsodeputy wrote:Yes, i did see your reply. It didn't work....
Once you add the curly brace, you may still get a permission denied error when testing the function locally (i.e., loading a test page directly from your hard drive then clicking the menu item will generate the "permission denied" error and the function won't work ). But if you upload the page to a webserver, and load the page through http, then it should work just fine, opening the "Add Favorite" dialog. Note that the function uses document.title, so your pages should have the title attribute set in order for the added favorite to have a description. If you don't have a title in your pages, holler and I can post an alternative method.
Defining a menu item that lets you "set this page as your home page" is a little more involved. The method you came across (code you posted) looks like it's meant to be called from an onclick handler in a static link; it probably will not work in a menu item. But I think it could still be done, with a slightly different approach. If you're still interested in trying that, let us know and we'll whip something up.
Cheers,
Kevin
-
- Beginner
- Posts: 5
- Joined: Fri Jan 14, 2005 4:51 am
- Contact:
Help on setting homepage
Kevin,
I did see the reply. I would like help with the Set as Homepage command. I've tried about everything. And, thanks for correcting the code, i'm going to change it right now!
Thanks again,
acsodeputy@comcast.net
I did see the reply. I would like help with the Set as Homepage command. I've tried about everything. And, thanks for correcting the code, i'm going to change it right now!
Thanks again,
acsodeputy@comcast.net
Hi Dustin,
FOR A "SET AS HOME PAGE" FUNCTION
Place the following code at the top of your menu_data.js file (or, if you're familiar with js, load it into the page however suits you).
You can now call this function from any menu item to set the current page as your home page. Appropriate aI() construction for the menu item would look like one of the following:
You can use either the url property or the clickfunciton property to call setAsHomePage(); both should work. I believe this approach to homepage setting only works in IE5+. I only have IE6 instralled right now, and it works on that. Might be worth testing in itehr versions before uploading to your site (note... you should test through a web server if you can... might not work right if testing locally).
FOR A VERSATILE BOOKMARKING FUNCTION
The following function is a somewhat versatile bookmarking (favorites) function.
The funciton can be called with no parameters, one parameter, or two parameters passed.
mm_addToFavorites() - no parameters - opens the Add Favorite dialog, using the current page's URL as the favorite location and the current page's title as the favorite name.
mm_addToFavorites(string favName) - one parameter - opens the Add favorite dialog, using the current page's URL as the favorite location and the value of favName as the favorite name.
mm_addToFavorites(string favURL, string favName) - two parameters - opens the Add favorite dialog, using the value of favURL as the favorite location and the value of favName as the favorite name.
Examples:
Should work in IE5+. Make sure to test it using a real web server... it'll probably generate a permission denied error if you try to test locally.
Cheers,
Kevin
FOR A "SET AS HOME PAGE" FUNCTION
Place the following code at the top of your menu_data.js file (or, if you're familiar with js, load it into the page however suits you).
Code: Select all
function mm_setAsHomePage()
{
if (ie5 || ie55) {
itemObj = gmobj("el" + _itemRef);
itemObj.style.behavior = "url(#default#homepage)";
itemObj.setHomepage(location.href);
}
else
alert("Sorry, your browser does not support this function.");
}
Code: Select all
aI("text=Make this your Home page;url=javascript:mm_setAsHomePage();");
aI("text=Make us your Home;clickfunction=mm_setAsHomePage();");
FOR A VERSATILE BOOKMARKING FUNCTION
The following function is a somewhat versatile bookmarking (favorites) function.
Code: Select all
function mm_addToFavorites()
{
if (window.external)
{
if (arguments.length < 1)
window.external.AddFavorite(location.href, document.title);
if (arguments.length == 1)
window.external.AddFavorite(location.href, arguments[0]);
if (arguments.length == 2)
window.external.AddFavorite(arguments[0], arguments[1]);
}
else
alert("Sorry, your browser doesn't support automated bookmarks.\nYou'll have to do it manually.");
}
mm_addToFavorites() - no parameters - opens the Add Favorite dialog, using the current page's URL as the favorite location and the current page's title as the favorite name.
mm_addToFavorites(string favName) - one parameter - opens the Add favorite dialog, using the current page's URL as the favorite location and the value of favName as the favorite name.
mm_addToFavorites(string favURL, string favName) - two parameters - opens the Add favorite dialog, using the value of favURL as the favorite location and the value of favName as the favorite name.
Examples:
Code: Select all
aI("text=Add us to your Favorites;url=javascript:mm_addToFavorites();");
aI("text=Make us a Favorite;url=javascript:mm_addToFavorites('The Best Site Ever');");
aI("text=Bookmark Us;url=javascript:mm_addToFavorites('http://www.bestsiteever.com', 'The Best Site Ever');");
Cheers,
Kevin
-
- Beginner
- Posts: 5
- Joined: Fri Jan 14, 2005 4:51 am
- Contact:
Thanks!!!
Kevin,
Thanks a TON! You are the smartest... It worked perfectly without any problems at all!
Thanks again.
If you need anything, email me!
Dustin Jones
Thanks a TON! You are the smartest... It worked perfectly without any problems at all!
Thanks again.
If you need anything, email me!
Dustin Jones
Re: Thanks!!!
You're welcome Dustin. Glad it works for you.acsodeputy wrote:Kevin,
Thanks a TON! You are the smartest... It worked perfectly without any problems at all!
Thanks again.
If you need anything, email me!
Dustin Jones
See there John? I'm the smart est... not a smart aleck!
Kevin
Re: Thanks!!!
And he wants to start already at this early hour...kevin3442 wrote:See there John? I'm the smart est... not a smart aleck!
John