I have a form that generates a link.
A user selects an option from a dropdown menu then via a javascript function a link is created in a textarea box.
I would like to add a text box to the form so a user has an option to add their own text if they don’t want to use the dropdown menu.
Here is the form code:
Javascript Function:
I can't seem to find a example anywhere on the net.
Is this possible?
Thanks.
A user selects an option from a dropdown menu then via a javascript function a link is created in a textarea box.
I would like to add a text box to the form so a user has an option to add their own text if they don’t want to use the dropdown menu.
Here is the form code:
Code:
<form name="linkForm">
<input type="hidden" name="url" value="<%= str_address %>" />
<input type="hidden" name="name" value="Test" />
<input type="hidden" name="target" value="_blank" />
<select name="display" onChange="MakeLink()">
<option value="<%= str_Name_A %>"><%= str_Name_A %></option>
<option value="<%= str_Name_B %>"><%= str_Name_B %></option>
<option value="<%= str_Name_C %>"><%= str_Name_C %></option>
<option value="<%= str_Name_D %>"><%= str_Name_D %></option>
</select>
<br>
<br>
<textarea rows="3" cols="70" name="output" id="output" onClick="SelectAll('output');"></textarea>
</form>
Javascript Function:
Code:
function MakeLink() {
var url = FormField("url");
var display = FormField("display");
var target = FormField("target");
var name = FormField("name");
var linkstr = "<a href=\"" + url + "\"";
if (name.length > 0) {
linkstr += " name=\"" + name + "\"";
}
linkstr += " target=\"" + target + "\">" + display + "</a>";
document.linkForm.output.value = linkstr;
document.linkForm.output.focus();
}
I can't seem to find a example anywhere on the net.
Is this possible?
Thanks.