In the File Manager project im trying to move the code for creating a new directory into the Header User control. I've moved the CreateDir in the Header user control of the file manager. I know this has to do with my targeting as I get the javascript error:
document.forms.BrowseFiles.elements.funcParam is null or not an object
Here is the relevant page code when viewing source (after page parsing)
Code:
<input name="Header:funcParam" id="Header_funcParam" type="hidden" />
<table class="MenuTable" border="0" width="100%">
<tr>
<td>
<a href="javascript:CreateDir();">
<img border="0" src="./Images/NewFolder.gif" />
</a>
<a id="Header_CreateDir" href="javascript:__doPostBack('Header$CreateDir','')">
</a>
</td>
</tr>
</table>
and here is the javascript
:
Code:
<script language="javascript">
function CreateDir()
{
dirName = prompt('Type the name of the directory:','');
if((dirName) && (dirName!=""))
{
document.forms['BrowseFiles'].elements['funcParam'].value = dirName;
__doPostBack('CreateDir','');
}
</script>
Here is the __doPostBack javascript
Code:
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["BrowseFiles"];
}
else {
theform = document.BrowseFiles;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
Any help would be greatly appreciated.