HEJSAN! Beror ju lite på hur din sida är uppbyggd, men om du vill ha knappen och "funktionen" på samma sida: hej!FSO Delete
skulle vilja få denna funktion att ske då man klickar på en knapp (type="button")
någon som kan hjälpa mig för jag vet inte hur jag skall fixa det :-(
<%
'***************** Delete
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObject = fso.GetFile(Server.MapPath("..\file\") & "\myfile.txt")
fileObject.Delete
Set fileObject = Nothing
Set fso = Nothing
%>Sv: FSO Delete
<input type="button" value="RADERA" onClick="location.href='?action=doDelete'">
<%
IF Request.QueryString("action")="doDelete" THEN
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObject = fso.GetFile(Server.MapPath("..\file\") & "\myfile.txt")
fileObject.Delete
Set fileObject = Nothing
Set fso = Nothing
END IF
%>Sv: FSO Delete
okej jag skulle kanske vart mer tydlig men så här ser det ut där jag vill få in funktionen.
jag har 2 st filer jag vill kunna radera från serven och det är:
<%=rs("pdf")%>
<%=rs("img")%>
jag vill kunna ha 2 knappar (type="button") som fixar det
här nere är koden till den sida som jag vill ha knapparna på
jag har en knapp "Load new file" som ligger i slutet på sidan det är där jag vill få in knapparna
skulle vara jätte snällt om någon kunde hjälpa mig med detta!
/Tommy Lindblom
******************************************************************************
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath ("orders.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
Addera = "SELECT * FROM TFT WHERE OrderID =" & Request.QueryString("OrderID")
rs.Open Addera, Connect, 3, 3
if request.querystring("action")="spara" then
rs("Model")=request.form("Model")
rs("Digits")=request.form("Digits")
rs("Digits2")=request.form("Digits2")
rs("ODWxHmm2")=request.form("ODWxHmm2")
rs("ODWxHmm3")=request.form("ODWxHmm3")
rs("VAWxHmm")=request.form("VAWxHmm")
rs("ODWxHmm")=request.form("ODWxHmm")
rs("VAWxHmm2")=request.form("VAWxHmm2")
rs("Duty")=request.form("Duty")
rs("Backlight")=request.form("Backlight")
rs("pdf")=request.form("pdf")
rs("Connectionmethod")=request.form("Connectionmethod")
rs("img")=request.form("img")
rs("ikon")=request.form("ikon")
rs("Other")=request.form("Other")
rs("Interface")=request.form("Interface")
rs("link_name1")=request.form("link_name1")
rs("link_name2")=request.form("link_name2")
rs("link_name3")=request.form("link_name3")
rs("link_name4")=request.form("link_name4")
rs("link_name5")=request.form("link_name5")
rs("link_name6")=request.form("link_name6")
rs("link_url1")=request.form("link_url1")
rs("link_url2")=request.form("link_url2")
rs("link_url3")=request.form("link_url3")
rs("link_url4")=request.form("link_url4")
rs("link_url5")=request.form("link_url5")
rs("link_url6")=request.form("link_url6")
rs("produkt_txt")=request.form("produkt_txt")
rs("x1") = (request.form ("ODWxHmm2"))*(request.form ("ODWxHmm"))*(request.form ("ODWxHmm3"))
rs("x3") = (request.form ("Digits"))*(request.form ("Digits2"))
rs.update
end if
%>
<body leftmargin="50" topmargin="0">
<p></p>
<form action="display_andra2.asp?action=spara&OrderID=<%=rs("OrderID")%>" method="post" name="form1">
<table width="60%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr align="left" valign="top">
<td colspan="3" valign="top"><font size="3"><strong>Interface board<br>
</strong></font><font color="#FF0033" size="2">* Requested fields. Only
number and comma (Ex 10 or 10,4).</font> <hr align="left" width="400"> <font size="3"><strong>
</strong></font></td>
</tr>
<tr align="left" valign="top">
<td colspan="2" align="center" valign="top"><div id="Layer1" style="position:absolute; visibility:visible; left:500px; top:15px; width:250px; z-index:1; height: 99px;">" target="_blank">
<table width="100%" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle"><font size="2">Klick to see »</font>
" target="_blank"><%=rs("pdf")%></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top"><img src="../file/<%=rs("img")%>" border="1" galleryimg="no"></td>
</tr>
<tr>
<td align="left" valign="bottom"><font color="#000000">image name: <%=rs("img")%><br>
</font></td>
</tr>
</table>
<br>
" target="_blank">
</div></td>
<td><input name="x3" type="hidden" id="x3" value="<%=rs("x3")%>" size="9"><input name="x1" type="hidden" id="x1" value="<%=rs("x1")%>" size="9">
<input name="x2" type="hidden" id="x2" value="<%=rs("x2")%>" size="9">
<input name="textfield" type="hidden" class="tum" value="" size="3">
<input name="ODWxHmm2" type="hidden" id="ODWxHmm22" value="<%=rs("ODWxHmm2")%>" size="5">
<input name="ODWxHmm" type="hidden" id="ODWxHmm4" value="<%=rs("ODWxHmm")%>" size="5">
<input name="ODWxHmm3" type="hidden" id="ODWxHmm32" value="<%=rs("ODWxHmm3")%>" size="5">
<input name="Backlight" type="hidden" value="<%=rs("Backlight")%>" size="3"></td>
</tr>
<tr align="left" valign="top">
<td colspan="2"><strong>Model:</strong><br> <input name="Model" type="text" value="<%=rs("Model")%>">
</td>
<td width="65%"><strong><font color="#FF0033">* </font>Vcc:</strong><br>
<input name="Digits" type="text" value="<%=rs("Digits")%>" size="2">
+
<input name="Digits2" type="text" value="<%=rs("Digits2")%>" size="2">
VDC </td>
</tr>
<tr align="left" valign="top">
<td height="32" colspan="2"><strong>Type:</strong><br>
<input name="VAWxHmm" type="text" value="<%=rs("VAWxHmm")%>"></td>
<td><strong>Input controller method:</strong><br>
<input name="Interface" type="text" id="Interface2" value="<%=rs("Interface")%>"></td>
</tr>
<tr align="left" valign="top">
<td colspan="2"><strong>Applicable mechanism :</strong><br>
<input name="Duty" type="text" value="<%=rs("Duty")%>">
</td>
<td><strong>Other:</strong><br>
<input name="Other" type="text" value="<%=rs("Other")%>">
</td>
</tr>
<tr align="left" valign="top">
<td colspan="2"><strong>CPU:</strong><br>
<input name="Connectionmethod" type="text" value="<%=rs("Connectionmethod")%>">
</td>
<td> </td>
</tr>
<tr align="left" valign="top">
<td colspan="3"><hr align="left" width="400"></td>
</tr>
<tr align="left" valign="top">
<td width="20%"><strong>Link name:</strong><br> <input name="link_name1" type="text" value="<%=rs("link_name1")%>"></td>
<td width="15%" align="center" valign="middle"> <strong><img src="images/linktxt_to-url.gif" alt="" name="" width="80" height="30" galleryimg="no"></strong></td>
<td><strong>http://www.</strong><br> <input name="link_url1" type="text" value="<%=rs("link_url1")%>"></td>
</tr>
<tr align="left" valign="top">
<td><strong>Link name:</strong><br> <input name="link_name2" type="text" value="<%=rs("link_name2")%>"></td>
<td align="center" valign="middle"> <strong><img src="images/linktxt_to-url.gif" alt="" name="" width="80" height="30" galleryimg="no"></strong></td>
<td><strong>http://www.</strong><br> <input name="link_url2" type="text" value="<%=rs("link_url2")%>"></td>
</tr>
<tr align="left" valign="top">
<td><strong>Link name:</strong><br> <input name="link_name3" type="text" value="<%=rs("link_name3")%>"></td>
<td align="center" valign="middle"> <strong><img src="images/linktxt_to-url.gif" alt="" name="" width="80" height="30" galleryimg="no"></strong></td>
<td><strong>http://www.</strong><br> <input name="link_url3" type="text" value="<%=rs("link_url3")%>"></td>
</tr>
<tr align="left" valign="top">
<td><strong>Link name:</strong><br> <input name="link_name4" type="text" value="<%=rs("link_name4")%>"></td>
<td align="center" valign="middle"><strong><img src="images/linktxt_to-url.gif" alt="" name="" width="80" height="30" galleryimg="no"></strong></td>
<td><strong>http://www.</strong><br> <input name="link_url4" type="text" value="<%=rs("link_url4")%>"></td>
</tr>
<tr align="left" valign="top">
<td><strong>Link name: </strong><br> <input name="link_name5" type="text" value="<%=rs("link_name5")%>">
</td>
<td align="center" valign="middle"><strong><img src="images/linktxt_to-url.gif" alt="" name="" width="80" height="30" galleryimg="no"></strong></td>
<td><strong>http://www.</strong><br> <input name="link_url5" type="text" value="<%=rs("link_url5")%>"></td>
</tr>
<tr align="left" valign="top">
<td><strong>Link name:</strong><br> <input name="link_name6" type="text" value="<%=rs("link_name6")%>"></td>
<td align="center" valign="middle"><strong><img src="images/linktxt_to-url.gif" alt="" name="" width="80" height="30" galleryimg="no"></strong></td>
<td><strong>http://www.</strong><br> <input name="link_url6" type="text" value="<%=rs("link_url6")%>"></td>
</tr>
<tr align="left" valign="top">
<td colspan="3"> </td>
</tr>
<tr align="left" valign="top">
<td colspan="3"><strong>Product text:</strong><br> <textarea name="produkt_txt" cols="60" rows="5"><%=rs("produkt_txt")%></textarea>
</td>
</tr>
<tr align="left" valign="top">
<td colspan="3"><hr align="left" width="400"></td>
</tr>
<tr align="left" valign="top">
<td colspan="3"> <table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><table width="100%" border="0">
<tr>
<td width="69%" align="left">
<input name="img" type="text" class="textfield" id="iPath" value="<%=rs("img")%>" size="30">
<input name="button3" type="button" class="button" onclick="javascript:addpic();" value="Browse for image">
</td>
<td width="31%" align="left"> </td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td width="66%" align="left">
<input name="pdf" type="text" class="textfield" id="pPath" value="<%=rs("pdf")%>" size="30">
<input name="button22" type="button" class="button" onclick="javascript:addpdf();" value="Browse for Pdf file">
</td>
<td width="34%" align="left"> </td>
</tr>
</table>
<p><input name="aa2" type="button" class="button" id="aa" onClick="MM_openBrWindow('../txtadmin/new_delete_doc.asp','','width=420,height=700')" value="Load new file">
</p>
<p> </p></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr align="left" valign="top">
<td colspan="3"><hr align="left" width="400"></td>
</tr>
<tr align="left" valign="top">
<td colspan="3"> <input name="Submit" type="submit" class="button" value="save">
<strong></strong>
«
Go back </td>
</tr>
</table>
</form>
<br>