如何使用 runscript 命令中的变量

发布于 2024-09-06 07:30:36 字数 355 浏览 2 评论 0原文

我从网页上获取一些文本 5,19 € 3,50 € 我想在“€”之后分割此文本。为此,我

runScript | javascript{var prices = storedVars['price'].split("€"); document.write(prices[0]); document.write(prices[1])};

在尝试此命令后

getEval | alert(storedVars['prices[0]'])

使用此命令,答案是价格未定义。 这里有什么问题吗?如何从 runScript 命令获取此变量?

谢谢你帮助我!

I get some text from a web page 5,19 € 3,50 €
I want to split this text after "€". for that I'm using this command

runScript | javascript{var prices = storedVars['price'].split("€"); document.write(prices[0]); document.write(prices[1])};

after done that try this command

getEval | alert(storedVars['prices[0]'])

the answer is that prices is undefined.
what is the problem here? how can I get this variable from a runScript command?

thanks for helping me!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

z祗昰~ 2024-09-13 07:30:36

尝试使用 storeEval 代替。

store | £1.99 | fullPrice
storeEval | storedVars['fullPrice'].split("£")[1] | price
echo | ${price}

Try using storeEval instead.

store | £1.99 | fullPrice
storeEval | storedVars['fullPrice'].split("£")[1] | price
echo | ${price}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文