Current location: Hot Scripts Forums » General Web Coding » JavaScript » Displaying Form Value Next To Input Field


Displaying Form Value Next To Input Field

Reply
  #1 (permalink)  
Old 12-06-07, 10:58 PM
Jay_Z Jay_Z is offline
Newbie Coder
 
Join Date: Oct 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Displaying Form Value Next To Input Field

I'm making a form where people can enter a web address and the name of the site, and after they lose focus off of the input field, I want to display a link to the site. How do I do this?

So far I've come up with this:

Code:
<input type="text" name="webaddress" id="webaddress" />
<input type="text" name="name" id="name" onblur="document.write('<a href=' +document.getElementById('webaddress').value+ '>' +document.getElementById('name')+ '</a>)" />
That code doesn't work. I typed this code up myself, and I'm still just learning JS. Any help?
Reply With Quote
  #2 (permalink)  
Old 12-07-07, 02:49 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
HTML Code:
<div id="web"></div>

<input type="text" name="webaddress" onblur="document.getElementById('web').innerHTML = this.value;" />
Give this a try.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with FormMail script for simple contact form amang Perl 2 09-21-07 07:59 PM
Questions form zoliky PHP 1 09-17-06 02:51 PM
Use MySql field as source for form select field CutAndPaste PHP 3 03-14-05 09:35 PM
formmail problem gscraper Perl 12 08-27-04 03:06 AM
Disable form fields to be submitted RickyRod JavaScript 2 05-24-04 10:15 AM


All times are GMT -5. The time now is 11:32 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.