PDA

View Full Version : javascript popup url to form input



rich1234
04-11-2009, 04:12 PM
Hi, I just wondered if anyone had a working model of this, a pop up that can insert a url with title and anchor text to a form. Any pointer would be a great help.
Thanks
Richard



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<SCRIPT LANGUAGE="JavaScript">
function SaveAndClose()
{
window.opener.dialogArguments.value = '<%=strFileName%>';
window.close();
}
</SCRIPT>
<link href="default_style.css" rel="stylesheet" type="text/css" />
</head>
<body style="margin:0px;" OnLoad="initialise();">
<table width="100%" border="0" cellpadding="3" cellspacing="0" >
<form method="post" name="link">
<tr>
<td colspan="2"><h1></h1></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td width="20%" align="right" class="text"></td>
<td width="80%"><select name="selType" id="selType" onChange="swapLinkType(this)">
<option value="link" selected>Hyperlink</option>
<option value="email">Email</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td height="240">
<span id="hyperlink">
<table width="100%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td width="20%" align="right" class="text"></td>
<td width="80%">
<select name="link" id="link" onChange="disablePreview(this)">
<option value="http://" selected>http://</option>
<option value="https://">https://</option>
<option value="ftp://">ftp://</option>
<option value="file://">file://</option>
<option value="news://">news://</option>
<option value="telnet://">telnet://</option>
</select>
<input name="URL" type="text" id="URL" size="27" onchange="document.getElementById('Submit').disabled=false;" onkeypress="document.getElementById('Submit').disabled=false;">
<input name="preview" type="button" id="preview" value="" onClick="showPreview(document.getElementById('linkChoice'))">
</td>
</tr>
<tr>
<td align="right" class="text"></td>
<td><input name="Title" type="text" id="Title" size="40" maxlength="40"></td>
</tr>
<tr>
<td align="right" class="text"></td>
<td><select name="windowSel" id="windowSel" onChange="document.getElementById('Window').value=this.options[this.selectedIndex].value">
<option value="" selected>Default</option>
<option value="_blank">New Window</option>
<option value="_self">Same Window</option>
<option value="_parent">Parent Window</option>
<option value="_top">Top Window</option>
</select>
<input name="Window" type="text" id="Window" size="12" maxlength="15"></td>
</tr>
<tr>
<td align="right" valign="top" class="text">:</td>
<td><iframe src="" id="previewLink" width="98%" height="100px" style="border: #A5ACB2 1px solid;backgroundColor: #FFFFFF;"></iframe></td>
</tr>
</table>
</span>
<span id="mailLink" style="display:none">
<table width="100%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td align="right" class="text"></td>
<td><input name="email" type="text" id="email" size="40" onfocus="document.forms.frmLinkInsrt.Submit.disabled=false;"></td>
</tr>
<tr>
<td width="20%" align="right" class="text"></td>
<td width="80%"><input name="subject" type="text" id="subject" size="40" maxlength="50"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;<br /><br /><br /><br /><br /><br /><br /><br /></td>
</tr>
</table>
</span> </td>
</tr>
</table></td>
</tr>
<tr>

<td valign="top">&nbsp;</td>
<td align="right" nowrap="nowrap" valign="top"><input type="hidden" name="postBack" value="true"><input type="submit" id="Submit" name="Submit" value="">&nbsp;<input type="button" name="cancel" value="" onClick="window.close()">
<br /><br />
</td>
</tr>
</form>
</table>
</body>
</html>