将dom元素绑定到javascript变量 [英] Binding of a dom element to a javascript variable

查看:164
本文介绍了将dom元素绑定到javascript变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很喜欢js,我的任务就是这样:
我要绑定一个可以从这个代码下载的测量对象:
https://github.com/Mikhus/canv-gauge.git



到一个dom元素,以便从c ++软件获取它。
如何创建我的var并使用id设置它,只是使用GetElementFromId dom方法?



谢谢你,
Daniele

解决方案

如果要在JavaScript代码和主机C ++应用程序之间进行交互(如使用V8,CEF或 Minko ),你可以:




  • eval从C ++主机(例如Minko提供 AbstractDOM :: eval()方法)使用由C ++主机实现特定的cipher

  • 调用方法提供的代码,例如Minko提供了一个-way C ++ / JS消息系统描述 here


I'm new to js and my task is this: I've to bind a gauge object like one you can download from this rep: https://github.com/Mikhus/canv-gauge.git

to a dom element in order to get it from c++ software. How can I create my var and set it with id, just to use GetElementFromId dom method?

thank you, Daniele

解决方案

If you want to interact between JavaScript code and a host C++ app (like an app built with V8, CEF or Minko), you can:

  • call eval from the C++ host (for example Minko provides the AbstractDOM::eval() method) using the code provided by cipher
  • call methods specific to the C++ host implementation, for example Minko provides a two-way C++/JS messaging system described here

这篇关于将dom元素绑定到javascript变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆