Jump to content

submit a href not working


ted_chou12

Recommended Posts

Hi, I am trying to get this submit a href but doesnt seem to work:

 

<%
if [ -z $OPEN ] ; then
			OPEN="[color=red]<a href=\"javascript: if (ConfirmDownload('$FILENAME')) {setValue('$FILENAME'); downloadfile.submit();}\" style=\"cursor:pointer;\">"[/color]
		fi
%>
<script language="JavaScript">
	function setValue(value){
	folderlist.folder.value = value;
        		downloadfile.download.value = value;
	actions.folder.value = value;
        		return true;
}

function ConfirmDownload(filename){
        		return confirm ('Download file ' + filename + ' ?');
}
</script>



<form id=downloadfile name=downloadfile action="test.php" method="POST">
	<input type=hidden name=download value="<%= ${CURDIR:-/} %>">
	[color=red]<input type=hidden name=submit value="submit">[/color]
</form>

When I tried pushing the submit button, it does try to load the post page, but using the a href does not.

Thanks,

Ted

Link to comment
Share on other sites

Hi, I will post the entire code up, this is my page, I cant spot any errors:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 
<head> 
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<link rel="stylesheet" type="text/css" href="../style/daleri-single.css" /> 
<title>File Explorer</title> 
</head> 

<body> 
<div id="wrap"> 
<h1><a href="index.html">NAS Home Page</a></h1> 
<p class="slogan">File Explorer</p> 

<p class="toptabs"> 

[color=red]	<script language="JavaScript"> 
	function setValue(value){
	folderlist.folder.value = value;
        		downloadfile.download.value = value;
	actions.folder.value = value;
        		return true;
}

function ConfirmDownload(filename){
        		return confirm ('Download file ' + filename + ' ?');
}
</script> [/color]


<a class="toptab" href="../index.html">Home</a><span class="hide"> | </span> 
<a class="toptab" href="samba.cgi">Samba</a><span class="hide"> | </span> 
<a class="toptab" href="fileexplorer.cgi">File Manager</a><span class="hide"> | </span> 
<a class="toptab" href="cron.cgi">Cron Jobs</a><span class="hide"> | </span> 
<a class="toptab" href="lighttpd.cgi">Lighttpd</a><span class="hide"> | </span> 
<a class="toptab" href="mediaserver.cgi">Media Server</a><span class="hide"> | </span> 

</p> 

<div id="maincontent"> 
<div style="text-align:right;"><b style="float:left;">Current directory: /</b> 
<a onClick="setValue('extra.txt'); downloadfile.submit();" style="cursor:pointer;"><b>Move Up Directory</b></a> 
   <a onClick="setValue('');folderlist.submit();" style="cursor:pointer;"><b>Refresh Current Directory</b></a></div> 
[color=red]<form id=folderlist name=folderlist action="/cgi-bin/smbclient.cgi" method="POST"> 
<pre><table> 
<tr><td><a onClick="setValue('/.');folderlist.submit();" style="cursor:pointer;"><img src="../style/fex/folder.png" /></a></td> 
		<td style="width:270px"><a onClick="setValue('/.');folderlist.submit();" style="cursor:pointer;"><font color="black">.</font></a></td> 
		<td>  D        0  Sat Jul 17 15:56:42 2010</td></tr><tr><td><a onClick="setValue('/..');folderlist.submit();" style="cursor:pointer;"><img src="../style/fex/folder.png" /></a></td> 
		<td style="width:270px"><a onClick="setValue('/..');folderlist.submit();" style="cursor:pointer;"><font color="black">..</font></a></td> 
		<td>  D        0  Sat Jul 17 15:56:42 2010</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('1.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('1.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">1.txt</font></a></td> 
		<td>  A      127  Fri Aug 31 10:14:51 2007</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('2.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('2.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">2.txt</font></a></td> 
		<td>  A      427  Wed Jun 25 12:41:44 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('college.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('college.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">college.txt</font></a></td> 
		<td>  A     2125  Sat Apr 28 17:52:02 2007</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('complaint.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('complaint.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">complaint.txt</font></a></td> 
		<td>  A      371  Wed Aug 29 07:55:25 2007</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('extra.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('extra.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">extra.txt</font></a></td> 
		<td>  A     1377  Thu Apr  3 11:51:33 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('gash.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('gash.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">gash.txt</font></a></td> 
		<td>  A      883  Sun Mar 30 10:57:42 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('links.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('links.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">links.txt</font></a></td> 
		<td>  A     1040  Tue May 15 07:56:39 2007</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('memory...txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('memory...txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">memory...txt</font></a></td> 
		<td>  A     7279  Sun Aug 10 11:12:44 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('question.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('question.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">question.txt</font></a></td> 
		<td>  A      212  Fri Jul  4 19:46:29 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('records.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('records.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">records.txt</font></a></td> 
		<td>  A      923  Wed Jul  2 01:16:39 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('records2.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('records2.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">records2.txt</font></a></td> 
		<td>  A     6248  Tue Jul 29 23:09:39 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('roommate.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('roommate.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">roommate.txt</font></a></td> 
		<td>  A     1060  Sun Aug  3 02:12:56 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('uni.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/txt.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('uni.txt')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">uni.txt</font></a></td> 
		<td>  A      292  Wed Jul 30 22:03:45 2008</td></tr><tr><td><a onClick="javascript: if (ConfirmDownload('		59616 blocks o')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><img src="../style/fex/59616blockso.png" /></a></td> 
		<td style="width:270px"><a onClick="javascript: if (ConfirmDownload('		59616 blocks o')) {downloadfile.download.value = value; downloadfile.submit();}" style="cursor:pointer;"><font color="black">		59616 blocks o</font></a></td> 
		<td>f size 8388608. 37454 blocks available</td></tr></table></pre> 
<div style="margin: 20px 15px 10px 15px; text-align:center;"><i>There is no File in this Directory</i></div> 
<input type=hidden name=folder value="/"> 
</form> [/color]



[color=red]<form id=downloadfile name=downloadfile action="test.php" method="POST"> 
	<input type=hidden name=download value="/"> 
	<input type=hidden name=submit value="submit"> 
</form> [/color]

[color=red]<form id=actions name=actions action="/cgi-bin/smbclient.cgi" method="POST" enctype="multipart/form-data"> 


<input type=hidden name=folder value="/"> 
</form> [/color]


	<p class="bottomlinks"><a href="#">Bottom link 1</a> | <a href="#">Bottom link 2</a> | <a href="#">Bottom link 3</a> | <a href="#">Bottom link 4</a> | <a href="#">Bottom link 5</a> | <a href="#">Bottom link 6</a></p> 
</div> 

<p class="footer">Copyright © 2010 <a href="index.html">Ted Chou</a><br /> 
</div> 
</body> 
</html>

Thanks,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.