Announcement

Collapse
No announcement yet.

What is the HTML to hard-code a link to another site into a fragment?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    What is the HTML to hard-code a link to another site into a fragment?

    The HTML to create a link is:

    <a href="http://www.domain.co.uk/pagename.html">Link Text Goes Here</a>

    Replace 'www.domain.co.uk/pagename.html' with the URL that the link should go to and replace 'Link Text Goes Here' with the text to display for the link. The above example would display as:

    Link Text Goes Here

    To use an image instead of text for the link replace 'Link Text Goes Here' with:

    <img src="imagename.jpg" alt="alt text" border="0">

    Replace 'imagename.jpg' with the name of your image and replace 'alt text' with the text to display if the mouse hovers over the image or if the image does not show for some reason. You will need to add the image into the 'Design | Additional Files' list to ensure that it is uploaded to the website.

    To ensure that the HTML is correctly rendered when adding this into the fragment 'text' field you should surround the contents of the 'text' field with the embedding tags. Put '!!<' at the beginning and '>!!' at the end (without the apostrophes).

    Alternatively, to have the link generated automatically, you can do the following:

    * In Firefox, right click on your 'Bookmarks' toolbar, and click 'New bookmark'

    * Give it a name of 'Link Generator'

    * Paste the following code into the 'location' field:

    javascript:function htmlEscape(s){s=s.replace(/&/g,'&');s=s.replace(/>/g,'>');s=s.replace(/</g,'<');return s;} function linkEscape(s){s=s.replace(/&/g,'&');s=s.replace(/"/,'"');return s} h = '<a href="' + linkEscape(location.href) + '">' + htmlEscape(document.title) + '</a>'; with(window.open().document){write(h+'<form name=f><textarea name=a rows=5 cols=80 wrap=hard>'+htmlEscape(h)+'</textarea></form>'); close(); f.a.select(); } void 0

    * Click 'OK'

    * Browse to your target page and click the bookmark

    * This causes your browser to craft a link to the current page, using its title as the link text. You can copy and paste this code into your fragment.
Working...
X