Create a Link to use as a Bookmarklet

[Total: 0    Average: 0/5]

This shows how to have a url dynmically created on your page to be used as a bookmarklet.

Head Code:


var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;

function display(id, str) {
  if (NS4) {
    with (document[id].document) {
  } else {
    document.all[id].innerHTML = str;

function noEntry() {
  alert("Please enter the desired code for the bookmark.");

function updateLink(form) {
  if (!NS4 && !IE4) return;

  var bmname = form.bmname.value;
  var jscode = form.jscode.value;
  var contactname = form.contactname.value;
  var contactemail = form.contactemail.value;
  var linkcode = "<A HREF='' NAME='bmlink'>" + bmname + "</A>";
  display("bookmark", linkcode);
  var jslink = (NS4) ? document.bookmark.document.links[0] : document.all.bmlink;
  jslink.href = 

// -->

Body Code:

<h1>"Template" for Netscape bookmarklet for add.cgi</h1>
This would work in IE, but there is a better way, but this will work in both.

<p>Explain what this is .... bla bla bla</p>

Enter the desired name of the bookmark (the button):<br>

<!-- You might want to edit the value field -->
<INPUT NAME="bmname" VALUE="Add to YourSite" SIZE ="50">

<!-- You must change the path to your add.cgi -->
<input type="hidden" name="jscode" value=""><br><br>
<!-- no more changes needed in the form -->

Enter your name:<br>
<INPUT NAME="contactname" VALUE="Editor name" SIZE="50" MAXLENGTH="255"><br><br>
Enter your email address:<br>
<INPUT NAME="contactemail" VALUE="Editor's email" SIZE="50" MAXLENGTH="255"><br><br>
<INPUT TYPE="button" VALUE="Update" onClick="updateLink(this.form)">&nbsp;&nbsp;
<SPAN ID="bookmark" STYLE="POSITION: absolute; left:200; top:400"><U>the bookmark code will show here</U></SPAN>

Times Viewed: 23

Leave a Reply

Your email address will not be published. Required fields are marked *