Forum Moderators: open

Message Too Old, No Replies

External .js - Help

         

roberthilley

11:48 pm on Apr 3, 2007 (gmt 0)

10+ Year Member



Could somebody help me out - please :-)

I am trying to get the following snippet into an external .js file:

<a href="http://www.example.com/bookmark.php" onclick="window.open('http://www.example.com/bookmark.php?wt=nw&pub=schmidtandclark&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'example', 'scrollbars=no,menubar=no,width=600,height=565,resizable=no,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100'); return false;" title="Bookmark using any bookmark manager!" target="_blank">Social Bookmark Button</a>

The full line of html that I have going is as follows:

<p align="right" style="padding: 10px"><a href="#" onclick="Emailit()">Send to Friend</a> ¦ <a href="http://www.example.com/bookmark.php" onclick="window.open('http://www.example.com/bookmark.php?wt=nw&pub=schmidtandclark&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'example', 'scrollbars=no,menubar=no,width=600,height=565,resizable=no,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100'); return false;" title="Bookmark using any bookmark manager!" target="_blank">Social Bookmark Button</a></p>

As you can see, I already have one external reference for the "Emailit" but cannot figure out how I should reference the "Social Bookmark Button" in the html or in the .js file.

Any help would be much appritiated.

[edited by: encyclo at 2:34 am (utc) on April 4, 2007]
[edit reason] examplified, see terms of service [/edit]

Dabrowski

10:31 am on Apr 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just create a function that contains the current onClick code, and change the A's onClick to call this function.

function openIt() {
window.open.................
}

<a href='#' onClick='javascript:openIt()'>