HTML:
var paras = document.getElementsByClassName('hi');
for (var i = 0; i < paras.length; i++) {
paras[i].style.color = '#ff0011';
// $('.hi').remove();
}
Run Code Online (Sandbox Code Playgroud)
我到目前为止的JS:
<p class="hi">dood</p>
<p class="hi">dood</p>
<p class="hi">dood</p>
<p class="hi">dood</p>
<p class="hi">dood</p>
<p>not class 'hi'</p>
Run Code Online (Sandbox Code Playgroud)
在jQuery中,这太简单了.($('.hi').remove();
).我想学习JS,然后学习jQuery.
我被困了,谷歌没有提供.我不想成为复制/粘贴jQuery程序员.我刚开始学习JS.谢谢.
就目前而言,这仅在WebKit中进行了测试.
<video>
使用poster
属性在元素上设置海报图像时,将在用户播放视频之前显示此图像(默认行为).但是,如果海报图像的宽高比与<video>
设置的元素的宽高比不同,则在图像的两侧(左侧或右侧或顶部和底部)可以看到空白(或可能是黑色空间),图像为居中(也是默认行为).
我想知道如何缩放此图像(最好是在CSS中),以便填充视频元素,类似于使用CSS3 background-size: cover;
值.
仍然困惑?也许这个JSFiddle会帮助解释:http://jsfiddle.net/jonnymilano/2w2CE/
我也有兴趣将图像强制放入视频容器,扭曲其高度和/或宽度以适应视频容器的尺寸.但是,这个答案只会部分解决我的问题.
使用CSS和下面的例子,有没有办法只选择<p>
后面的<ul>
's?
如果没有,什么是jQuery选择器,还是需要if
声明?
<p>Hello there.</p>
<p>Select this para!</p>
<ul>
<li>list item</li>
</ul>
<ul>
<li>don't select this list! :)</li>
</ul>
<p>And don't select this paragraph! :)</p>
Run Code Online (Sandbox Code Playgroud) 这里提出的问题是:如何使用VBA从Excel向服务器发送HTTP POST请求?几乎正是我正在寻找的,除了我试图将大量文件发送到服务器.我进一步搜索,发现如何使用VBA通过HTTP帖子上传zip文件?这也很好,但非常令人沮丧 - 这似乎是很多工作(不仅仅是在这里制作HTML表单......).
这里的选项#2:http://www.motobit.com/tips/detpg_post-binary-data-url/(正如上面提到的关于SO的问题中所引用的)似乎它会运作良好,但是当我在JS工作时CSS,我不知道如何在示例中创建FormData(发送到服务器的二进制文件).
谁能帮帮我吗?本质上,我想通过VBA从HTTP内部通过HTTP_POST将3-6个文件从Excel内部发送到期望表单数据的Web服务器上的PHP脚本.处理此问题的HTML表单如下所示:
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input type="submit" />
</form>
Run Code Online (Sandbox Code Playgroud)
谢谢大家.
编辑 - 2012年8月2日
我还在努力解决这个问题.我不知道VBA/6,几乎只是基本的JS所以我有点失落.这是我到目前为止所做的:
Sub HTTPInternetPutFile()
' create new object with WinHttpRequest for this operation
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
Dim FormFields As String
' initialize variables that we will set and pass as parameters
Dim sfpath
Dim strURL …
Run Code Online (Sandbox Code Playgroud) 我是Windows和Powershell noobie.我来自Linux Land.我曾经在我的这个小Bash函数.bashrc
中将一个" shruggie "(¯\_(?)_/¯
)复制到剪贴板上,以便我可以将它粘贴到Slack上的对话等等.
我的Bash别名看起来像这样: alias shruggie='printf "¯\_(?)_/¯" | xclip -selection c && echo "¯\_(?)_/¯"'
我意识到这个问题是少年,但答案确实对我有价值,因为我确信我将需要在未来的某个时刻将非UTF-8字符输出到Powershell脚本中输出.
我在PowerShell配置文件中编写了这个函数:
function shruggie() {
'¯\_(?)_/¯' | clip
Write-Host '¯\_(?)_/¯ copied to clipboard.' -foregroundcolor yellow
}
Run Code Online (Sandbox Code Playgroud)
但是,当我在命令行上调用它时,这给了我:( ??\_(???)_/??
未知的UTF-8字符被转换为?
).
我已经查看了[System.Text.Encoding]::UTF8
一些其他 问题,但我不知道如何将我的字符串转换为UTF-8并将其传递到clip.exe
另一端(在剪贴板上)接收UTF-8.
它必须迟到......鉴于以下HTML,除了每个段落中的第一段之外,如何选择所有段落div.thePost
?
我试过了:
$('.thePost').children('p:gt(0)')
Run Code Online (Sandbox Code Playgroud)
和
$('.thePost p:gt(0)')
Run Code Online (Sandbox Code Playgroud)
和
$('.thePost > p:gt(0)')
Run Code Online (Sandbox Code Playgroud)
所有这些都适用于第一个,div.thePost
但最终选择<p>
任何其他div中的所有其他标签与类thePost
.
<div id="contentmiddle">
<div class="thePost">
<h1>...</h1>
<h3>...</h3>
<span>...</span>
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
</div><!-- /thePost -->
<div class="thePost">
<h1>...</h1>
<h3>...</h3>
<span>...</span>
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
</div><!-- /thePost -->
</div>?<!-- /contentmiddle -->
Run Code Online (Sandbox Code Playgroud) css3 ×2
jquery ×2
css ×1
excel ×1
excel-vba ×1
html ×1
html5 ×1
html5-video ×1
http-post ×1
javascript ×1
powershell ×1
vba ×1