Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript form element

Status
Not open for further replies.

stvchez123

Programmer
Apr 18, 2002
59
0
0
US
I am wondering if this is possible using javascript and a single HTML page. Being an ASP developer, I know that it's possible going that route, but wonder if javascript couldn't do the same task on a single HTML page.

Here is a sample:

Basically, I'd want to enter a form field (this is in its simplest form):
click submit
then on that same page, basically just place that address in a new form window which shows:

<a href="more code... more code

the goal would be for someone to easily enter text, then propulate in a window with the associated. hope that isn't confusing, but that is the general idea.
 
You mean like this?
Code:
<script>
function formatLink(){
  var win=window.open();
  win.document.open("text/plain");
  win.document.write("<a href=\"");
  win.document.write(document.f.url.value);
  win.document.write("\">" + document.f.lbl.value + "</a>");
  win.document.close();
}
</script>

<form name="f" onsubmit="formatLink();return false">
  <table>
    <tr>
      <td>URL</td>
      <td><input type="text" name="url">
    </tr>
    <tr>
      <td>Label</td>
      <td><input type="text" name="lbl">
    </tr>
    <tr>
      <td></td>
      <td><input type="submit" value="Submit"></td>
    </tr>
  </table>
</form>

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top