Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#
This isn't working:
Response.Write("<a href=view.aspx?type="+Content+"onclick=\"Delete('"+f+"')\"> DELETE </a>");
<script language="javascript" type="text/javascript">
function Delete(path) {
path1 = unescape(path);
var myObject = new ActiveXObject("Scripting.FileSystemObject");
var myFolder = myObject.GetFolder(path1);
myFolder.Delete();
alert("Welcome");
}
</script>
But this worked.
Response.Write("<a href=view.aspx?type="+Content+"onclick=\"Delete()\"> DELETE </a>");
<script language="javascript" type="text/javascript">
function Delete() {
alert("Welcome");
}
</script>
I tried with onclick for Delete() to get just ALERT it worked well.
But it isn't working when add the parameters.Can y开发者_如何转开发ou help me please.Trying for this from long time please.
First of all, \u is escpae code for a hex digit. So better re-format it.
Second, href=view.aspx?type=notes is not a valid html syntax too. Double quotes please.
Third, please put some code to check if your javascript variables (myObject,myFolder) are valid (not null) before invoke any method against them.
加载中,请稍侯......
精彩评论