简体   繁体   English

如何将特定的javascript函数调用到html中?

[英]How to call a specific javascript function into html?

as mentioned in the title I need a specific javascript function to be called in html, the function changes constantly upon pressing start and it looks the following: 如标题中所述,我需要在html中调用特定的javascript函数,该函数在按下start时会不断变化,它看起来如下:

<dt style="width: 120px">Start 1:</dt> <dd style="margin-left: 150px">{{ start.number1 }}</dd>

{{ start.number1 }} is the function I need to be displayed in html, could you help me with that please? {{start.number1}}是我需要在html中显示的功能,你能帮帮我吗? Thanks in advance. 提前致谢。

Using curly brackets to bind a Javascript variable into your HTML view is something very typical of javascript frameworks that provide Data Binding such as AngularJS or EmberJS This might be what you're looking for. 使用大括号将Javascript变量绑定到HTML视图中是非常典型的javascript框架,提供数据绑定 ,如AngularJSEmberJS这可能是您正在寻找的。

There are of course other ways of doing this, such as the new Object.observe() function that's available in Chrome, but it will take a while until its widely supported. 当然还有其他方法可以做到这一点,例如Chrome中提供的新的Object.observe()函数,但它需要一段时间才能得到广泛的支持。

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

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