使用 javascript (facebox) 编辑已经制作的 html
我正在使用facebox(你可能知道它),我的脚本看起来像
$.extend($.facebox, {
settings: {
opacity : 0,
overlay : true,
loadingImage : 'http://example.com/images/loading.gif',
closeImage : 'http://example.com/images/closelabel.gif',
imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
faceboxHtml : '\
<div id="facebox" style="display:none;"> \
<div class="popup"> \
<table> \
<tbody> \
<tr> \
<td class="tl"/><td class="b"/><td class="tr"/> \
</tr> \
<tr> \
<td class="b"/> \
<td class="body"> \
<div class="content"> \
</div> \
<div id="footer"> \
<p class="left" id="changable"> \
Footer \
</p> \
<p class="right"> \
<a href="#" class="close"> \
<img src="http://example.com/images/closelabel.gif" title="close" class="close_image" /> \
</a> \
</p> \
</div> \
</td> \
<td class="b"/> \
</tr> \
<tr> \
<td class="bl"/><td class="b"/><td class="br"/> \
</tr> \
</tbody> \
</table> \
</div> \
</div>'
},
在文件中,即使用文本 (远程 html)我想根据文件更改页脚。将打开多个remote.html 文件(share.php、warning.php),我想根据这些文件更改页脚。我可以在这个 javascript 中做些什么,或者我可以在 share.php 和 warning.php 中做些什么来获取并将其内容设置为新内容吗?
我尝试过:(
$(function() {
$("#changable").html('Hello');
});
$(function() {
$("#changable").innerHTML = 'Hello';
});
$(function() {
$("#changable").text('Hello');
});
$(function() {
$(".left").html('Hello');
});
我安装了jquery)但什么也没有。
我是 javascript 的新手,我知道这可能很容易,但我无法让它在我的一生中发挥作用。
提前致谢。
I am using facebox (you may know of it) and my script looks like
$.extend($.facebox, {
settings: {
opacity : 0,
overlay : true,
loadingImage : 'http://example.com/images/loading.gif',
closeImage : 'http://example.com/images/closelabel.gif',
imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
faceboxHtml : '\
<div id="facebox" style="display:none;"> \
<div class="popup"> \
<table> \
<tbody> \
<tr> \
<td class="tl"/><td class="b"/><td class="tr"/> \
</tr> \
<tr> \
<td class="b"/> \
<td class="body"> \
<div class="content"> \
</div> \
<div id="footer"> \
<p class="left" id="changable"> \
Footer \
</p> \
<p class="right"> \
<a href="#" class="close"> \
<img src="http://example.com/images/closelabel.gif" title="close" class="close_image" /> \
</a> \
</p> \
</div> \
</td> \
<td class="b"/> \
</tr> \
<tr> \
<td class="bl"/><td class="b"/><td class="br"/> \
</tr> \
</tbody> \
</table> \
</div> \
</div>'
},
and in the file, that is using text
(remote html) I want to change the footer depending on the file. Multiple remote.html files will be open (share.php, warning.php) and I want to change the footer depending on those. Is there something I can do in this javascript, or is there something I can do within each of share.php and warning.php to grab the and set it's content to something new?
I tried:
$(function() {
$("#changable").html('Hello');
});
$(function() {
$("#changable").innerHTML = 'Hello';
});
$(function() {
$("#changable").text('Hello');
});
$(function() {
$(".left").html('Hello');
});
(I have jquery installed) but nothing.
I'm new to javascript, and I know this is probably easy, but I can't get it working for the life of me.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Jquery 解决方案试试这个...
使用代码
By trigerring an event. My sample code is here...
Jquery solution Try this...
Use the code
By trigerring an event. My sample code is here...
我只需
在每个远程文件中添加:即可使其正常工作。然而,由于我用不同的方式解决了这个问题,我将@mohan ram 标记为正确。
I got it working by just adding:
to each of the remote files. However, since I solved it a different way, I marked @mohan ram as right.