Thread: Automatic Links
Results 1 to 2 of 2
Related
-
Automatic linking Forum: HTML Forum
Replies: 3 -
Automatic Mail (subscribing) Forum: Website Scripts Forum
Replies: 5 -
automatic download pdf Forum: HTML Forum
Replies: 4
-
06-09-2004, 11:21 PM #1
Automatic Links
Hi there, everybody. I've got an interesting question for you all.
I run a quaint little blog, hosted by Blogger. I have many friends that I commonly link to. However, with Blogger's new templates, the sidebar is packed with stuff already, and it would just be cluttered with links if I was to put my friends blogs in there. I'd like to have some way of automatically linking to one of my friends websites when I type their name in a post. For example:
My friend Grace has a journal at http://dreamsarefun.blogspot.com Rather than writing all that time-consuming HTML to put the link in the journal, I'd like to just type "Grace" and have it automatically link to that site. Is there any possible way to do this?
And if not, can anybody think of a nice clean way to organize my links, without them taking up too much space?
My journal's at http://urbishia.blogspot.com
Thanks a heap.
-
06-10-2004, 05:51 AM #2bald headed old fart
Status- Offline
Join Date- Aug 2003
Location- chertsey, a small town 25 miles south west of london, england.
Posts- 739
Hi there Urbish,
Try this code. It has three links, but can be extended to any number.
To test type in the input box...
- google or
- yahoo or
- Grace
The inputs are case sensitive so Google or grace would bring up an alert box.
The styling and positioning are done with 'css'.
Just adjust the values to suit your needs and taste
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Strict XHTML Template</title> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> <style type="text/css"> /*<![CDATA[*/ body { background:#aaaaff; } #container { position:absolute; left:40%; top:40%; width:110px; background:#ffffff; border:solid 1px #000000; } #link { width:100px; margin:5px; } #button { width:100px; background:#ffffff; margin:5px; font-family:arial; font-size:13px; color:#000000; } /*//]]>*/ </style> <script type="text/javascript"> //<![CDATA[ var links=new Array('http://www.google.com','http://www.yahoo.com','http://dreamsarefun.blogspot.com/'); var names=new Array('google','yahoo','Grace'); function openLink() { var typed=document.forms[0][0].value; for(p=0;p<names.length;p++) { if(typed==names[p]) { location.href=links[p]; return; } } if(typed!=names[p]) { alert(typed+' is not in the data base.\n\nThe inputs are case sensitive so.....\n\nyou may have made a typing error.\n\nPlease check and then try again') } } //]]> </script> </head> <body onload="document.forms[0][0].focus();"> <form action=""> <div id="container"> <input id="link" type="text" /><br /> <input id="button" type="button" value="automatic link"onclick="openLink()"/> </div> </form> </body> </html>