問題描述
這不起作用:
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>
但這行得通.
Response.Write("<a href=view.aspx?type="+Content+"onclick="Delete()"> DELETE </a>");
<script language="javascript" type="text/javascript">
function Delete() {
alert("Welcome");
}
</script>
我嘗試使用 Delete()
的 onclick 來獲得 ALERT
效果很好.但是添加參數(shù)時不起作用.請您幫幫我.請嘗試很久.
I tried with onclick for Delete()
to get just ALERT
it worked well.
But it isn't working when add the parameters.Can you help me please.Trying for this from long time please.
推薦答案
首先,u 是十六進制數(shù)字的 escpae 代碼.所以最好重新格式化它.
First of all, u is escpae code for a hex digit. So better re-format it.
其次,href=view.aspx?type=notes 也不是有效的 html 語法.請用雙引號.
Second, href=view.aspx?type=notes is not a valid html syntax too. Double quotes please.
第三,在對它們調(diào)用任何方法之前,請輸入一些代碼來檢查您的 javascript 變量(myObject,myFolder)是否有效(不為空).
Third, please put some code to check if your javascript variables (myObject,myFolder) are valid (not null) before invoke any method against them.
這篇關(guān)于單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!