2

此解决方案必须使用 google 关闭 javascript 库,而不是任何其他 javascript 库。

当 url 加载时,我想动态打开一个拆分面板,其中一侧包含 iframe 中 url 的内容,另一侧包含有关正在发生的操作的日志信息。

下面是使用 google 闭包库的拆分面板的一般设置,但我不确定如何添加 iframe 并将其源设置为当前页面 url。

var lhs = new goog.ui.Component();
var rhs = new goog.ui.Component();

// Set up splitpane with already existing DOM.
var splitpane1 = new goog.ui.SplitPane(lhs, rhs,
    goog.ui.SplitPane.Orientation.HORIZONTAL);

// Need to create an iframe with src of current url and add that to the rhs element.
4

1 回答 1

2

渲染组件后,您应该能够只获取底层元素并执行您需要的任何操作。就像是:

var iframe = goog.dom.createDom('iframe', { 'src': 'rhs.html' });
rhs.getElement().appendChild(iframe);
于 2011-06-15T03:59:35.780 回答