You are here: Re: Create a link from an entry field « HTML « IT news, forums, messages
Re: Create a link from an entry field

Posted by Cogito on 12/14/06 00:27

On Mon, 11 Dec 2006 18:00:22 -0800, I V <wrongbad@gmail.com> wrote:

>On Tue, 12 Dec 2006 00:28:06 +0000, Cogito wrote:
>> Now guys, even if it is only academic, we can't let HTML beat us.
>> There must be a way of transferring the entered URL to a link.
>
>You could try this. I've only tested it on Firefox, so YMMV:
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
><html>
> <head>
> <title>URL transferer</title>
> <script type="text/javascript">
> var link, input;
>
> function init()
> {
> link = document.getElementById('lnk');
> input = document.getElementById('npt');
> }
>
> function make_link()
> {
> var anchor = document.createElement('a');
> var caption = document.createTextNode(input.value);
> anchor.href = input.value;
> anchor.appendChild(caption);
> while(link.firstChild)
> link.removeChild(link.firstChild);
> link.appendChild(anchor);
> }
>
> </script>
> </head>
> <body onload="init();">
> <form>
> <p>
> <input type="text" id="npt">
> <input type="button" value="Make link" onclick="make_link();">
> </p>
> <p id="lnk"></p>
> </form>
> </body>
></html>

After using the 'URL transferer 1.0' for a couple of days I must say
that it comes very close to the best thing since sliced bread. If I'm
not pushing my luck too much, I would suggest a slight improvement to
make it 'URL transferer 1.1'.

It would be nice if when clicking the entry field while there is
already a previous URL, the URL will be automatically selected to
facilitate easy replacement with a new URL. It would save the process
of manually deleting what's there already.
Alternatively a 'clear' button would be just as good.

I'm sure that 'URL transferer 1.1' is going to be the perfect and
final release.

Either way, thanks for a very useful tool.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация