简体   繁体   English

回声Javascript链接

[英]Echo Javascript Link

I wonder whether someone can help me please. 我想知道是否有人可以帮助我。

I've put together the following which creates a table within my HTML form. 我整理了以下内容,这些内容在HTML表单中创建了一个表。

echo("<tr>");
        echo("<td>");echo($mvcfile->FileName);echo("</td>");
        echo("<td>");echo($mvcfile->FileSize);echo("</td>");
        echo("<td>");echo("<a href='javascript:void(0)' onclick='Attachment_Remove(this)'>remove</a>");echo("</td>");
        echo("</tr>");

I'm now trying to add a Javascript link with the word 'Remove' so users can delete a file from the list. 我现在正尝试添加带有“删除”一词的Javascript链接,以便用户可以从列表中删除文件。

I've been researching various sites and tutorials and I've put together the following: echo("<td>");echo("<a href='javascript:void(0)' onclick='Attachment_Remove(this)'>remove</a>");echo("</td>"); 我一直在研究各种站点和教程,并整理了以下内容: echo("<td>");echo("<a href='javascript:void(0)' onclick='Attachment_Remove(this)'>remove</a>");echo("</td>"); which will then run the appplicable Javascript. 然后将运行适用的Javascript。

The problem I have is that the 'Remove' link isn't being created and I'm not sure why, because from what I've read I thought I'd put it together correctly, but clearly not. 我的问题是没有创建“删除”链接,我不确定为什么,因为从我阅读的内容来看,我认为我可以正确地将其放在一起,但显然不能。

I just wondered whether someone could perhaps please have a look at this and let me know where I've gone wrong. 我只是想知道是否有人可以看看这个,然后让我知道我哪里出了问题。

Try tidying up your code: 尝试整理您的代码:

echo "<tr>
    <td>".$mvcfile->FileName."</td>
    <td>".$mvcfile->FileSize."</td>
    <td><a href=\"javascript:void(0);\" onclick=\"Attachment_Remove(this);\">remove</a></td>
</tr>";

See if that works. 看看是否可行。 If it doesn't, try right-click => View Source and see if the link is there. 如果不是,请尝试右键单击=>“查看源代码”,然后查看链接是否存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM