简体   繁体   中英

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.

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.

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>"); which will then run the appplicable 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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