Need a Javascript that...
Hi.
I am looking for a javascript that when a button is clicked, it will show an input box that asks for the name of a site, and than another input box that asks for the URL to that site.
After the two var's are entered, it created an html tag
<a href="$site">$name</a> and places it into a textarea.
If anyone can suggest where to look for a script similiar to this, or where to find info to create a script like this, that would be great thanks.
------------------
[b]If you counted 24 hours a day, it would take 31,688 years to reach one trillion.b]
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
Rob Pengelly posted this at 20:43 — 24th November 1999.
They have: 850 posts
Joined: Jul 1999
Maybe I did not give enough info?
On the click of an input button I need somthing like
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
Anonymous posted this at 02:01 — 25th November 1999.
They have: 5,633 posts
Joined: Jan 1970
I don't know what you want with the textarea - not really relevant.
Try
site = window.prompt("What is the name of the site?");
url = window.prompt("What is the URL to the site?","http://www.");
document.write('<a href="' + url + '">' + site + '</a>');
You could always write this to a layer so that you can keep the rest of your page the same.
------------------
http://go.to/hass
Rob Pengelly posted this at 02:22 — 25th November 1999.
They have: 850 posts
Joined: Jul 1999
Thank you very much for the help.
So I would have
site = window.prompt("What is the name of the site?");
url = window.prompt("What is the URL to the site?","http://www.");
link="<a href="' + url + '">' + site + '</a>')";
What I wanted with the text area is that the variable link will be added to the textarea so the textarea will contain all of the links entered.
If you don't understand, I will try and explain again.
------------------
If you counted 24 hours a day, it would take 31,688 years to reach one trillion.
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
John Pollock posted this at 04:12 — 29th November 1999.
He has: 628 posts
Joined: Mar 1999
I don't think a link can be placed in a textarea, just text (except maybe IE4 or 5?)
The code below should gather urls and place them in the textarea:
<HEAD>
<SCRIPT language="JavaScript">
<!--
function get_url(a_url)
{
url = window.prompt("What is the URL to the site?","http://www.");
link= a_url+"\n"+url;
document.form1.the_urls.value=link;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM name="form1">
<TEXTAREA name="the_urls"></TEXTAREA>
<INPUT TYPE="button" onClick="get_url(document.form1.the_urls.value)">
</FORM>
</BODY>
I'm tired though, let me know if it helps any.
[This message has been edited by John Pollock (edited 28 November 1999).]
Java Script: A Beginner's Guide
Page Resource
Rob Pengelly posted this at 00:18 — 7th December 1999.
They have: 850 posts
Joined: Jul 1999
Thanks for the help !
John, the code you gave me was great, almost perfect , except I want the actual HTML code (<a href="url>name</a> ) to be placed in the text area.
So I have
url = window.prompt("What is the URL to the site?","http://");
name = window.prompt("What is the name of the site?","");
but instead of just adding the link to the textarea, how can I add the full HTML code for the URL/Site name to the textarea?
link=<a href="' + url + '">' + site + '</a>;
or somthing like that?
Thanks for the help!
------------------
The longest recorded flight of a chicken is 13 seconds.
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
Rob Pengelly posted this at 00:55 — 7th December 1999.
They have: 850 posts
Joined: Jul 1999
Never mind,
Patrick D helped me with it.
Thanks to everyone for the help.
------------------
A 'jiffy' is an actual unit of time for 1/100th of a second.
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.