473,544 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Complete beginners question on adding to favorites...

2 New Member
Hi all I a complete beginner when it come to using HTML code so please help me out!

All I want to do is create a link in my document that will add my page to the browers' favorites list. What I have created is a Roll-Over image in Dreamweaver 8, which is placed is a layout table. I know that the code to put the page into the favorites folder is [HTML]onclick='window .external.AddFa vorite(location .href,document. title)[/HTML] however I don't know where to fit it into my code... Here's what I have...

[HTML] <td height="28" colspan="2" valign="top"><a href="#" onmouseout="MM_ swapImgRestore( )" onmouseover="MM _swapImage('Add toFav','','imag es/frontpageALT_04 .gif',1)"><img src="images/frontpage_04.gi f" name="AddtoFav" width="98" height="28" border="0" id="AddtoFav" /></a><a onmouseover="MM _swapImage('Add toFav','','imag es/frontpageALT_04 .gif',1)" onmouseout="MM_ swapImgRestore( )"></a></td>
<td colspan="5" valign="top"><i mg src="images/frontpage_05.gi f" width="413" height="28" /></td>[/HTML]

Thanks in advance for your help!

EDIT: Typo fixed
Sep 4 '07 #1
2 1504
phvfl
173 Recognized Expert New Member
Hi Cob,

Welcome to TSDN...

To add the script functionality you would just put what you have within the anchor element that you want it to be linked to:

[HTML]
<a href="..." onclick="javasc ript"></a>
[/HTML]
Secondly there is not standard way to add bookmarks, the script that you have is IE specific so if a user of any other browser clicked the link then script would not execute. A javascript function that works on IE and FireFox (sorry, haven't found the methods for other browsers at the moment) is:

Expand|Select|Wrap|Line Numbers
  1. function bookmark(){
  2.     var $title=document.title;
  3.     var $url=self.location.href;
  4.  
  5.     if (window.sidebar){
  6.       window.sidebar.addPanel($title, $url,"");
  7.     } else if( document.all ){
  8.       window.external.AddFavorite( $url, $title);
  9.     } else {
  10.       alert("Sorry, your browser does not support this function. \n Please add the bookmark manually.");
  11.     }
  12.     return false;
  13. }
  14.  
The onclick attribute of your anchor would then call this function:

[HTML]
<a href="#" onclick="return bookmark();"></a>
[/HTML]
Sep 4 '07 #2
cob98tp
2 New Member
Thank you for this, it works perfectly and I certainly had no chance of getting there myself!
Sep 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
4861
by: shank | last post by:
Is there any one "add to favorites" code that will work for IE, NS, AOL, and a host of others? At least some code that will give me an effective "add to favorites" for the highest percentage of users. The code in my searches have been disclaimed has working with this but not that. I'm not sure how old some of this code is either. thanks!
5
2808
by: JP | last post by:
I have the need to be able to access the IE5+ favorites menu, read the title and URL for each shortcut so I can render the person's favorites list on a web page. The project I'm working on is written is C#, and is web based. I had hoped there was a URL property or something I could use in the System.IO class, but no such luck, and websites...
9
1739
by: Dennis Ruppert | last post by:
Greetings This is rather ambitious: I have a split database that contains many different reports. I have a form that the end user launches the reports from. They select the report criteria from several combo boxes, click a "Go" command button to launch the report. I then pass the report criteria to various report "templates" as an SQL...
2
1157
by: clintonG | last post by:
I've been hunting around. Does anybody have a URL to Microsoft'sdocumentation for Favorites? -- <%= Clinton Gallagher METROmilwaukee (sm) "A Regional Information Service" NET csgallagher AT metromilwaukee.com URL http://metromilwaukee.com/ URL http://clintongallagher.metromilwaukee.com/
2
1548
by: Tom McL. | last post by:
I have a new computer which came with sp2 and framework 1.1. I have noticed that my favorites that contain links to visual basic.net subjects that were saved under the earlier version framework no longer work. Upon investigating I found that the help files in the following directory: C:\Documents and Settings\All Users\Application...
5
1456
by: draken | last post by:
Basically, what I am looking to do is to sync up browsers favorites via a website without a download. I thought of javascript when first doing this, as I know, mozilla would allow me to pull them directly just with the js, but I do not want to have go beyond javascript and PHP. I have been going over making a mozilla extension as well as...
6
7574
by: Killer42 | last post by:
I have actually asked a pretty similar question here in the past, without a great deal of success. But I've decided to try a different tack. So, what are the ways in which a network admin could remove the Favorites menu from Windows Explorer (presumably by use of a group policy), and how can I overcome it and put my favorites menu back where it...
2
2711
hsriat
by: hsriat | last post by:
I have a page working on Ajax. The problem is, after doing many changes using Ajax (like uploading, changing name, adding to favorites etc), the status bar starts behaving unexpectedly. Even when nothing is being transfered, it displays Transferring data from localhost... and that too continuously. The progress bar also shows that its working, and...
5
3764
by: andrewq2 | last post by:
I have a post in fourms.micorsoft.com but no one is responding, and i had good luck in google groups befor so i decieded on posting my question here also. Im trying to add a favorites function to my web browser. the problem when i hit the add to favorites button it does nothing. but on form close it creates the favorites.xml file. so i know...
0
7416
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7761
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7363
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7701
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5899
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3403
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3400
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
983
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.