我正在使用excel从网页获取值.在其他元素中,HTML包含下表:
<div id="myDiv">
<table class="myTable">
<tbody>
<tr>
<td>Text1:</td>
<td class="data"><strong>0.51</strong></td>
</tr>
<tr>
<td>Text2:</td>
<td class="data"><strong>2199</strong></td>
</tr>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
该页面存储在变量oHtml中.它可以很好地抓住这个表外的其他元素.但是当我尝试捕获值0,51时,我在控制台中使用JS:
document.getElementById("myDiv").getElementsByClassName("myTable")[0].getElementsByClassName("data")[0].innerText
Run Code Online (Sandbox Code Playgroud)
并且选择值0,51.
但是,函数内使用的以下VBA代码返回#VALUE!
Function myFunction(id)
Call myConnection(id)
Set myDadta = oHtml.getElementById("myDiv").getElementsByClassName("myTable")(0).getElementsByClassName("data")(0)
myFunction = myData.innerText
End Function
Run Code Online (Sandbox Code Playgroud)
这是与IE的连接:
Public Sub myConnection(id)
Set oHtml = New HTMLDocument
With CreateObject("WINHTTP.WinHTTPRequest.5.1")
.Open "GET", "http://www.example.com" & id, False
.send
oHtml.body.innerHTML = .responseText
End With
End Sub
Run Code Online (Sandbox Code Playgroud)
正如我所说,这种语法在同一页面中与此表中的其他元素一起工作正常,为什么我会收到此错误?
我正在尝试使用Cytoscape构建磁贴.基本上,每个矩形(平铺)都有一个标题,我希望它在该矩形的范围内写入.
我的代码是:
var cy = cytoscape({
container: document.getElementById('cy'),
style: [
{
selector: 'node',
css: {
'shape': 'rectangle',
'width': '200',
'height': '150',
'content': 'data(name)',
'text-wrap': 'wrap',
'text-valign': 'center',
'text-halign': 'center',
'text-transform': 'uppercase'
}
}, ///
Run Code Online (Sandbox Code Playgroud)
和:
elements: {
nodes: [
{ data: { id: 'F1', name: 'This is my very long text long text long text long text long text long text long text'} },
{ data: { id: 'F2' } },
{ data: { id: 'c', parent: 'b' } }, …Run Code Online (Sandbox Code Playgroud) 是否可以为Excel 2007 or 2010没有构建自定义任务窗格Visual Studio,即仅使用VBA?
我发现了另一个问题,但这对我不起作用.
我正在尝试从Joomla 2.5.14获取当前的page_id,user_id和日期.这是我正在使用的代码:
<?php
$foo = $jinput->get('id');
echo $foo;
$user =& JFactory::getUser();
$usr_id = $user->get('id');
echo $usr_id;
$date =& JFactory::getDate();
echo 'Current date and time is: ' . $date->toFormat() . "\n";
?>
Run Code Online (Sandbox Code Playgroud)
JFactory工作正常(我得到当前用户和日期)但jinput给出了错误:
Notice: Undefined variable: jinput in`
Run Code Online (Sandbox Code Playgroud) 我想裁剪任何自然尺寸的图像,并给它宽度为100%,最大高度为200px,仅用于CSS.
在这里阅读了类似的问题后,我接近它,但图像仍然是水平拉伸的.
HTML:
<div class="moduleItemIntrotext"> <a class="moduleItemImage" href="/gestao/item/7479-o-que-é-o-zero-working-capital-e-o-que-pode-beneficiar-com-isso.html" title="Continue a ler "O que é o Zero Working Capital? (e o que pode beneficiar com isso)"">
<img src="http://www.portal-gestao.com/media/k2/items/cache/x99c309f8b22ccf674ef513c2b1fdd8b5_XL.jpg.pagespeed.ic.Me394YWuwk.jpg" alt="O que é o Zero Working Capital? (e o que pode beneficiar com isso)" width="900" height="900">
</a>
<p>O working capital (ou fundo de maneio) é a diferença entre o ativo corrente e passivo corrente. Numa empresa com capacidade para encarar as suas obrigações financeiras de curto-prazo, o ativo corrente …Run Code Online (Sandbox Code Playgroud) 我正在加载一个模态对话框:
var html = HtmlService.createHtmlOutputFromFile('File')
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setWidth(1000)
.setHeight(700);
SpreadsheetApp.getUi()
.showModalDialog(html, 'My Page');
Run Code Online (Sandbox Code Playgroud)
现在,在File.HTML中,我想用CSS设置加载另一个HTML文件,我该怎么做?
我已尝试将其包含在HtmlTemplate使用scriptlet中,但它不起作用:
<?!= include('File'); ?>
Run Code Online (Sandbox Code Playgroud)
编辑:
我在code.gs中定义了include函数:
function include (file) {
return HtmlService.createTemplateFromFile(file).evaluate().getContent();
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将具有特定类名的div元素的数据传递给Excel,例如:
<div class="myClass">
<span>Text1</span>
<span>Text2</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我的VBA代码:
Sub GetData()
Dim oHtml As HTMLDocument
Dim oElement As Object
Set oHtml = New HTMLDocument
With CreateObject("WINHTTP.WinHTTPRequest.5.1")
.Open "GET", "http://www.example.com/", False
.send
oHtml.body.innerHTML = .responseText
End With
For Each oElement In oHtml.getElementsByClassName("myClass")
Debug.Print oElement.Children(0).src
Next oElement
End Sub
Run Code Online (Sandbox Code Playgroud)
这将返回错误:运行时错误:'438':对象不支持此属性或方法.错误是在线Debug.Print ...
我已激活以下引用:Microsoft HTML对象库Microsoft Internet控件
我希望能够在第一个或第二个跨度上选择文本并将其粘贴到单元格上,我该怎么做?
如何从左到右找到URL中的最后一个数字?
例如:
https://www.portal-gestao.com/introducao-6849.html
Run Code Online (Sandbox Code Playgroud)
会回来: 6849
和:
https://www.portal-gestao.com/curso-modelos-negocio/1452-introducao/6850-melhores-praticas-no-uso-de-folhas-de-calculo.html
Run Code Online (Sandbox Code Playgroud)
会回来: 6850
这就是我正在尝试的:
编辑:更新的代码
jQuery('a.title').each(function () {
var $link=jQuery(this);
var href=$link.attr('href');
var idx = href.indexOf('/')!=-1?1:0; // choose the second one if slash
var procura=href.match(/(\d+)/g)[idx];
jQuery.each(obj,function(_,test) {
if(test.indexOf(procura)!=-1) { // only works on strings
....
}
});
});
Run Code Online (Sandbox Code Playgroud) 我有一个图片和一段文字的ul:
<ul id="botoes">
<li><a href="/o-meu-perfil"><img src="image.png"></a></li>
<li><a href="#">Perguntas</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我试图让两个项目水平对齐,因为它是一个水平列表.因此我正在使用:
#botoes li{
display: inline;
list-style-type: none;
padding-right: 20px;
vertical-align: top;
}
Run Code Online (Sandbox Code Playgroud)

我的字符串看起来像:
[10,20,30]
我想将它转换为数组.
我试过了:
$myArray=explode(",",$myString);
print_r($myArray);
Run Code Online (Sandbox Code Playgroud)
但这是回归:
Array ( [0] => [10 [1] => 20 [2] => 30] )
Run Code Online (Sandbox Code Playgroud)
我需要摆脱开/关括号.
有人可以帮忙吗?
我希望用户在警告框中输入一段文字.
HTML:
<form>
<select class="favoritefood">
<optgroup label="Dairy products">
<option>Cheese</option>
<option>Egg</option>
<option id="newDairy">NEW</option>
</optgroup>
<optgroup label="Vegetables">
<option>Cabbage</option>
<option>Lettuce</option>
<option>Beans</option>
<option>Onions</option>
<option>Courgettes</option>
<option id="newVeg">NEW</option>
</optgroup>
</select>
</form>
Run Code Online (Sandbox Code Playgroud)
JS:
$('.favoritefood').change(function () {
var id = $(this).find('option:selected').attr('id');
if (id == 'newDairy') {
alert("input");
};
});
Run Code Online (Sandbox Code Playgroud)
我知道可以在警报框中输入一个输入,但是怎么样?
我的数据框df如下所示:
Value
X.Y.Z 10
X.Y.K 20
X.Y.W 30
X.Y.Z.1 20
X.Y.K.1 5
X.Y.W.1 30
X.Y.Z.2 3
X.Y.K.2 23
X.Y.W.2 44
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用行名的第三个字符来对列进行命名,例如:
因此,行名现在是行的最后一个字符(在点之后)。我知道这是可能的做dplyr,我试过gather和spread,但没有运气,谁能帮助?
谢谢!
编辑:这是上面文本中的数据,我:
structure(list(..1 = c("X.Y.Z", "X.Y.K", "X.Y.W", "X.Y.Z.1",
"X.Y.K.1", "X.Y.W.1", "X.Y.Z.2", "X.Y.K.2", "X.Y.W.2"), Value = c(10,
20, 30, 20, 5, 30, 3, 23, 44)), class = "data.frame", row.names = c(NA,
-9L))
Run Code Online (Sandbox Code Playgroud) 我tabelaClientes在Sheet" Clientes"中有一个表,我想删除字段" Nome"为空的行.
我怎么做?
这就是我正在尝试的:
Sub Cliente()
Dim ws As Worksheet
Dim row As Range
Set ws = Sheets("Clientes")
For Each row In ws.[tabelaClientes[Nome]].Rows
If row.Value = "" Then
row.Delete
End If
Next
Exit Sub
Run Code Online (Sandbox Code Playgroud)
但这只删除了一些Nome空的行,而不是全部,为什么?