- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
我有一个脚本,它根据某些生成元素的请求调用,并通过 id 选择指定的元素。我遇到的奇怪问题是,选择对页面上的第一项完全有效,但对其他所有项目都返回 null。这可能是什么原因造成的?
这是相关的 Javascript:
<script type="text/javascript">
function showFrame(content, id, vid, crating)
{
var container = document.getElementById(vid+'_container');
$('#'+vid+'_embed').html(content);
$('#'+vid+'_embed iframe').attr('SCROLLING', 'YES');
var linkform = document.getElementById(vid + '_linkform');
linkform.setAttribute('action', '{{ url('/links/reportLink/') }}' + '/' + id);
$(document).on('submit', '#' + vid+ '_linkform', function() {
$.ajax({
url : $(this).attr('action'),
type : $(this).attr('method'),
data : $(this).serialize(),
beforeSend: function()
{
$('#ajax-loading').show();
},
success : function( data ) {
if (data == '{{trans("main.embeds report success")}}')
{
$('#'+vid+'_report-responses').html('<div class="alert alert-success alert-dismissable">{{ trans("main.embeds report success") }}<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>')
}
else
{
console.log(data);
$('#'+vid+'_report-responses').html('<div class="alert alert-danger alert-dismissable">' + 'An error occurred while trying to report this link..' + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>')
}
},
error : function( xhr, err ) {
alert(err);
}
});
return false;
});
$('#input-'+vid).rateit('value', crating);
$('#input-'+vid).bind('rated', function(e){
var ri = $(this);
var value = ri.rateit('value');
ri.rateit('readonly', true);
$.ajax({
url : '{{ url('/links/rateLink/') }}',
type : 'GET',
data : {id: id, value: value},
beforeSend: function()
{
$('#ajax-loading').show();
},
success : function( data ) {
console.log(data);
},
error : function( xhr, err ) {
alert(err);
ri.rateit('readonly', false);
}
});
});
container.style.display = 'block';
return false;
}
</script>
这里是html的一部分
<div id="93_container" style="display:none">
<div class="embed-container" id="93_embed">
</div>
<div class="rateit" style="margin: 12px 0px;" id="input-93" data-rateit-min="0" data-rateit-max="10" data-rateit-step="0.5" data-rateit-value="1">
Rate Link
</div>
<a style="float: right; color: white;" href="javascript:void(0);" onclick="toggleDiv('93');" title="Hide View" class="btn btn-default no-bord-left"><i class="fa fa-minus-square"></i> Hide View</a>
<form method="POST" action="http://varmium.com/links/reportLink/%7Bid%7D" accept-charset="UTF-8" id="93_linkform" style="color: white; margin: 2px; float: right">
<input name="_token" type="hidden" value="cQQjBjZpmhefNxqWgeL7z5w4L9IMAUExSIMxX99P">
<a href="http://varmium.com/login" title="Bad Link" class="btn btn-default no-bord-left"><i class="fa fa-trash-o"></i> Bad Link</a>
</div>
<div class="row responses" id="93_report-responses" style="clear: both;">
</div>
<p>
</p>
<span class="row grey-out">
Release Date: 2014-04-06
</span>
</div>
</div>
<hr>
<div class="media col-sm-12">
<div class="pull-left col-sm-3">
<img src="http://image.tmdb.org/t/p/w300/oGkDVdlPewF60qwKfWfyhWTXL5f.jpg" alt="Poster of The Lion and the Rose" class="media-object img-responsive thumb">
</div>
<div class="media-body col-sm-9">
<style>
.embed-container { position: relative; clear:both; padding-bottom: 56.25%; padding-top: 30px; height: 100%; overflow: hidden; max-width: 100%; height: auto; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
</style>
<div class="links-section">
<h3>
View
</h3>
<dt style="float: left;">
Link:
</dt>
<dd style="color: black;">
<a href="javascript:void(0)" onclick="showFrame('\x3Ciframe\x20width\x3D\x22640\x22\x20height\x3D\x22360\x22\x20frameborder\x3D\x220\x22\x20scrolling\x3D\x22NO\x22\x20marginheight\x3D\x220\x22\x20marginwidth\x3D\x220\x22\x20src\x3D\x22http\x3A\x2F\x2Fvodlocker\x2Ecom\x2Fembed\x2Dwqploakgu4sj\x2D640x360\x2Ehtml\x22\x3E\x0D\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Fiframe\x3E', 255, 94,10); return false;">http://vodlocker.com</a>
<span class="quality">
<i class="fa fa-signal">
</i>
</span>
HD
<span class="language">
<i class="fa fa-flag">
</i>
</span>
<span class="rating">
<i class="fa fa-star">
</i>
</span>
10
</dd>
<dt style="float: left;">
Link:
</dt>
<dd style="color: black;">
<a href="javascript:void(0)" onclick="showFrame('\x3Ciframe\x20width\x3D\x22640\x22\x20height\x3D\x22360\x22\x20frameborder\x3D\x220\x22\x20scrolling\x3D\x22NO\x22\x20marginheight\x3D\x220\x22\x20marginwidth\x3D\x220\x22\x20src\x3D\x22http\x3A\x2F\x2Fplayed\x2Eto\x2Fembed\x2Dtkzyscs3q4dr\x2D640x360\x2Ehtml\x22\x3E\x0D\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Fiframe\x3E', 256, 94,10); return false;">http://played.to</a>
<span class="quality">
<i class="fa fa-signal">
</i>
</span>
HD
<span class="language">
<i class="fa fa-flag">
</i>
</span>
<span class="rating">
<i class="fa fa-star">
</i>
</span>
10
</dd>
<dt style="float: left;">
Link:
</dt>
<dd style="color: black;">
<a href="javascript:void(0)" onclick="showFrame('\x3Ciframe\x20width\x3D\x22910\x22\x20height\x3D\x22425\x22\x20frameborder\x3D\x220\x22\x20scrolling\x3D\x22NO\x22\x20marginheight\x3D\x220\x22\x20marginwidth\x3D\x220\x22\x20src\x3D\x22http\x3A\x2F\x2Fthefile\x2Eme\x2Fembed\x2D1ojtp8mmg9y3\x2D910x405\x2Ehtml\x22\x3E\x0D\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Fiframe\x3E', 257, 94,10); return false;">http://thefile.me</a>
<span class="quality">
<i class="fa fa-signal">
</i>
</span>
HD
<span class="language">
<i class="fa fa-flag">
</i>
</span>
<span class="rating">
<i class="fa fa-star">
</i>
</span>
10
</dd>
</div>
<div id="94_container" style="display:none">
<div class="embed-container" id="94_embed">
</div>
<div class="rateit" style="margin: 12px 0px;" id="input-94" data-rateit-min="0" data-rateit-max="10" data-rateit-step="0.5" data-rateit-value="1">
Rate Link
</div>
<a style="float: right; color: white;" href="javascript:void(0);" onclick="toggleDiv('94');" title="Hide View" class="btn btn-default no-bord-left"><i class="fa fa-minus-square"></i> Hide View</a>
<form method="POST" action="http://varmium.com/links/reportLink/%7Bid%7D" accept-charset="UTF-8" id="94_linkform" style="color: white; margin: 2px; float: right">
<input name="_token" type="hidden" value="cQQjBjZpmhefNxqWgeL7z5w4L9IMAUExSIMxX99P">
<a href="http://varmium.com/login" title="Bad Link" class="btn btn-default no-bord-left"><i class="fa fa-trash-o"></i> Bad Link</a>
</div>
<div class="row responses" id="94_report-responses" style="clear: both;">
</div>
<p>
</p>
<span class="row grey-out">
Release Date: 2014-04-13
</span>
</div>
</div>
<hr>
<div class="media col-sm-12">
<div class="pull-left col-sm-3">
<img src="http://image.tmdb.org/t/p/w300/2FHwJZA82xHGMZE15Uq7IvW9grJ.jpg" alt="Poster of Breaker of Chains" class="media-object img-responsive thumb">
</div>
我有不同的 div,每个 div 都有一个调用相同函数的按钮。 . . . INIT . . . INIT 棘手的部分是每个按钮应该只对自己的 div 执行函数(#btn1 到 #div1、#
XSP.getElementById 和 document.getElementById 之间有什么区别?在我的测试中,两者似乎都返回相同的值(存储在字段中的值)。为 XPage 编码时应首选哪一个?
我通常会通过以下方式为某些事件注册 javascript 函数: myBtn.Attributes.Add("onClick", "Validate(getElementById('"+txtFirs
当我想检查页面中是否存在某个元素时。这两个检查是一样的吗?有没有更好更紧凑的方法来检查是否存在? 如果我想检查 value == '' 该怎么办。这也可以包含在这张支票中吗? 最佳答案 对元素的引用永
我尝试将新值分配给输入表单的隐藏输入和复选框。它在 Firefox 中工作正常,但在 IE 中则不然(我使用的是 IE 7)。有谁知道我的代码有什么问题吗? HTML: Javascript: v
我真的不知道如何描述我的问题,但基本上: 为了好玩,我在 JSFiddle 中编写了一个元素,不知何故我的代码输出只是上下跳动。 如果您想亲自查看,请单击下面的链接,然后单击“提交投诉”按钮。 问题是
document.getElementById("test").value document.getElementById("test").innerHTML 第一个表示地址,第二个表示存储在该地址的
在将 html block 插入 dom 之前,我对在 dom 外构建 html block 很感兴趣,因此我使用 dynatrace 进行了一些测试。我使用了bobince的方法: Is there
我在 GWT 应用程序中使用 native 函数,我尝试了这两种方法: document.getElementById("id") 返回 null 但 $doc.getElementById() 返回
以下代码有什么区别: Hover Over me SomeLink1 SomeLink2 SomeLink3
我正在尝试使用 javascript 设置 div 的内部 html,但由于某种原因,它不起作用。我发现其他人以前也遇到过这个问题,但我在其他帖子中找到的解决方案均无效。我不明白怎么了。 这是我的测试
编辑:我修复了分号、区分大小写以及方括号。如果我删除 buttonPARTICULAR 之后的函数,代码就可以工作!为什么? 编辑:固定。我是个笨蛋。对不起!!! :-Z 当我保持简单时,就像这样,一
很难说出这里问的是什么。这个问题是模棱两可的、模糊的、不完整的、过于宽泛的或修辞的,无法以目前的形式得到合理的回答。如需帮助澄清这个问题以便重新打开它,visit the help center .
我正在尝试创建一个通用的 JavaScript 函数来更改事件的属性。 它的工作方式是 function fooFunction(sourceElement) { var newName =
我需要获取元素的 ID,但该值是动态的,只有它的开头始终相同。 这是一段代码。 ID 总是以 poll- 开头,然后数字是动态的。 如何只使用 JavaScript 而不是 jQuery 获取 ID
我需要使用 VBA 从 HTML 中提取某些信息。 这是我试图单独提取位置信息的 HTML。 Location Dallas/Fort Worth Area Industry
我正在制作一个程序,该程序从输入字段返回值,然后根据条件将字段字符串更改为 x 结果。非常感谢您的帮助,因为这里的成员过去一直给我很大帮助。调试器抛出此错误,当然没有任何效果: script.js:2
我不确定为什么这不起作用,有人可以告诉我为什么吗? var red = [0, 100, 63]; var orange = [40, 100, 60]; var green = [75, 100,
这个问题已经有答案了: Javascript Shorthand for getElementById (24 个回答) 已关闭 8 年前。 我的下面的代码工作正常,但我想知道,是否有任何仅通过 Ja
我有这个simple HTML 标记: //a reserved property name id //same here 但是——运行: alert(document.getEle
我是一名优秀的程序员,十分优秀!