gpt4 book ai didi

html - 在 Seaside 中创建超链接,将图像作为可点击项

转载 作者:行者123 更新时间:2023-12-01 00:12:02 24 4
gpt4 key购买 nike

我正在使用 Instantiation VisualAge Smalltalk Seaside 构建网站。我知道以下内容。

renderContentOn: html
html anchor
url: 'http://www.seaside.st';
with: 'Visit the Seaside'.

但是,我想建立一个链接,其中图像是可点击的项目和下面的一些描述性文本。我现在正在做的是用 html 构建它并让 Seaside 呈现代码。我想使用 Seaside 以与上述相同的方式构建项目,但找不到任何提示。我使用的代码是这样的:

html html: '<a
href="http://www.mywebsite.com:8080/Show some details?', imagePath, '"><img
style="border: 0px solid ;
text-align: right;height: 130px;" alt=""
src=" http://www.mywebsite.com:8080/images/', imagePath, '"></a>
<br> some text'

是否有更好(和更多 Smalltalk)的方法?


'Show some details' 是我草率的打字。当然,它是一个有效的类名。

但是,我试过这个但遵循“html 文本:‘一些文本’。”它应该只显示文本,它还显示当前页面类 - 所以,如果我的类是 DPAClassName 那么网址:'http://www.mywebsite.com:8080/Show一些细节?,imagePath';成为

网址:'http://www.mywebsite.com:8080/DPAClassName ?, 图片路径';

显示屏显示文本 'Some Text but as following:'一些文本'DPAClassName

最佳答案

关键是在 with: 消息发送到任何 tag (anchor, image, paragraph 等),您可以将任何可呈现 对象传递给它。在您的第一个示例中,您传递了一个 String,但您也可以传递一个 BlockClosure 或理解 renderOn: 的任何其他对象。

所以,总而言之,相当于你想要的是:

    html anchor
url: 'http://www.mywebsite.com:8080/Show some details?, imagePath';
with: [
html image
style: 'border: 0; height: 130px;'
url: 'http://www.mywebsite.com:8080/images/', imagePath ].
html break.
html text: 'Some text'.

作为旁注,我认为 URI 的 Show some details 部分以及在未命名参数的情况下传递 imagePath 是有问题的。但这肯定超出了您的问题范围。

关于html - 在 Seaside 中创建超链接,将图像作为可点击项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60018814/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com