Here is a blog post that talks about how to add JavaScript to the CEWP.
But I like to use the HTML Form Web Part for this myself.
Now it comes down to how to get the link. Without knowing the criteria you wish to use to pick the row from the list it is hard to give you a very good example. But here is something to get you started.
Notice I like to use JQuery in my SharePoint pages... You might need to Google how to add JQuery to your pages.
$(document).ready(function(){ExecuteOrDelayUntilScriptLoaded(function(){
var context = new SP.ClientContext.get_current();
var list = "Name of List";
var view = "Name of View;
list = context.get_web().get_lists().getByTitle(listTitle);
view = list.get_views().getByTitle(viewTitle);
context.load(view);
context.executeQueryAsync(
function(sender, args) {getLinkListItem("<View><Query>" + view.get_viewQuery() + "</Query></View>")},
function(sender, args) {alert("error: " + args.get_message());}
);
}
}, 'sp.js')});
function getLinkListItem(camlQuery){
var context = SP.ClientContext.get_current();
var approvalList = context.get_web().get_lists().getByTitle(listTitle);
var query = new SP.CamlQuery();
query.set_viewXml(camlQuery);
listItems = approvalList.getItems(query);
context.load(listItems);
context.executeQueryAsync(ReadListItemSucceeded, ReadListItemFailed);
}
function ReadListItemSucceeded(sender, args) {
var itemsString = '';
var enumerator = listItems.getEnumerator();
//Use this while to populate your link tags with the proper URLs.
while (enumerator.moveNext()) {
var listItem = enumerator.get_current();
var link = listItem.get_item('URL').toString();
//Logic here.
}
}
function ReadListItemFailed(sender, args) {
alert('Request failed.');
}
Here are some links on the JavaScript Client Object Model you will find useful in modifying your script.
Chapter 13: SharePoint Client Object Model and jQuery (Professional SharePoint Branding and User Interface Design).
Using the SharePoint Foundation 2010 Managed Client Object Model