好的,我正在寻找一些很好的理由,因为不要在页面内容中使用iFrame.我的朋友设置为我们的聊天框使用iFrame并加载html页面而不是仅ajax
用于加载所需的参数并长时间轮询请求.一旦我们得到了参数,我们就会用我们的内容填写一些div.
我最大的原因
为什么要同时加载两个页面
注入iFrame需要更多编码
有没有人知道可能出现的任何其他可能的冲突和问题?我知道有一段时间iFrames被认为已被弃用,然后他们又回到了网站.
ps我不确定这是否应该在SO或MSO中,如果需要我可以移动它
我已经可以使用jQuery获取iframe的内容,但我想学习如何使用纯JavaScript来获取它.
这就是我到目前为止所拥有的.
var frame = document.getElementById('awc_frame');
var easyBB = frame.contentWindow.document.body.innerHTML;
easyBB.getElementById('chatbox-title').innerText="Chatbox";
Run Code Online (Sandbox Code Playgroud)
我做错了什么,请帮忙.最初框架没有ID,我已经尝试过了
var frame = document.frames['awc_frame'];
Run Code Online (Sandbox Code Playgroud)
跨浏览器有效吗?然后我如何获得contentWindow?只是一些解释,所以我可以用JavaScript而不是jQuery来做到这一点.jQuery版本是这样的
var frame = $('#avacweb_chat iframe');
var easyBB = $('#chatbox-title',frame.contents()).text('Chatbox');
Run Code Online (Sandbox Code Playgroud) $lang = array(
'thank you'=>'You are welcome',
'thanks'=>'You are welcome',
'thank ya'=>'You are welcome'
);
Run Code Online (Sandbox Code Playgroud)
正如你所看到的那样,为了相同的价值而写下多个键会让我感到厌烦.
$lang['thanks']=>$lang['thank ya']=>$lang['thank you']
Run Code Online (Sandbox Code Playgroud)
试着通过重写一百次来节省自己一些时间
PHP类功能:
function fetch_key($key, $l,$bool){
$dynamic = new l18n;
if($bool == true or is_null($bool)){
return addslashes( $dynamic->convert($key,$l) );
}else{
return $dynamic->convert($key,$l);
}
}
Run Code Online (Sandbox Code Playgroud)
EX
$lang = array(
'thank you'=>'You are welcome',
'thanks'=>'You are welcome',
'thank ya'=>'You are welcome',
'hello'=>'hello',
'goodbye'=>'goodbye'
);
Run Code Online (Sandbox Code Playgroud)
所以我需要将它添加到数组中,而不是用相同的值填充我的键值,实际上它们并非完全相同.我应该在开始时说明这一点
var path = location.pathname;
switch(path){
case (/\/memberlist/).test(path) :getCSS('url-22.css'); break;
case (/\/register/).test(path): getCSS('url-6.css'); break;
case (/buy-credits/g).test(path): getCSS('url-7.css'); break;
case (/\/?u(\d+)friends$/).test(path): getCSS('url-8.css'); break;
case (/\/privmsg/).test(path): getCSS('url-9.css'); break;
case (/\/?u(\d+)wall$/).test(path): getCSS('url-4.css'); break;
}
function getCSS(url,media){
var a = document.createElement('link');
a.href=url;
a.media= media || 'screen';
a.rel="stylesheet";
return (document.getElementsByTagName('head')[0].appendChild(a));
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码,由于某种原因,它没有运行应该运行的函数.出于测试目的,我们可以更改var path="/memberlist"
它仍然无法运行.有人可以向我解释为什么这不会运行.不要真的使用switch语句
我已经尝试了多种方法,通过在stackoverflow上搜索答案.
我有两种形式
表格1基本设置:
<form action="/post" class="frm-form" method="post" name="post"
onsubmit="return vB_Editior['text_editor'].prepare_submit(0,0)" id="quick_reply">
<textarea></textarea>
<input type="submit" name="post" value="Send">
</form>
Run Code Online (Sandbox Code Playgroud)
表2基本设置:
<form enctype="multipart/form-data" id="tagnotif" style="display:none;"
onsubmit="return vB_Editor['text_editor'].prepare_submit(0,0)" name="post2"
method="post" action="/privmsg">
<input id="username" class="post" type="text" tabindex="1" size="25"
name="username[]"style="margin:1px 0"><br />
<input id="acpro_inp10" class="post" type="text"
onkeypress="if (event.keyCode==13){return false}" title="" tabindex="2"
maxlength="64" size="45" value="You have been tagged" name="subject"><br />
<textarea id="textingnotification" rows="15" cols="9"
name="message" tabindex="3"></textarea>
<input type="hidden" value="" name="lt">
<input type="hidden" value="inbox" name="folder">
<input type="hidden" value="post" name="mode">
</form>
Run Code Online (Sandbox Code Playgroud)
我只需要在SEND印刷机上提交这两个表格
尝试使用主要脚本使用此代码变量:虽然它不会同时通过,但它不会刷新页面...
$(document).ready(function() {
$('#quick_reply').ajaxForm(function() {
alert("Thank you …
Run Code Online (Sandbox Code Playgroud) 我已经阅读了不同的解释,varchar
到目前为止我已经得到了这个:
CHAR( ) fixed from 0 to 255 characters long
VARCHAR( ) variable from 0 to 255 characters long
TINYTEXT maximum length of 255 characters
TEXT maximum length of 65535 characters
BLOB maximum length of 65535 characters
MEDIUMTEXT maximum length of 16777215 characters
MEDIUMBLOB maximum length of 16777215 characters
LONGTEXT maximum length of 4294967295 characters
LONGBLOB maximum length of 4294967295 characters
Run Code Online (Sandbox Code Playgroud)
然后这个
char(n)变量存储固定长度的字符串,该字符串恰好包含n个字符(因此,n个字节).它们的大小限制为8,000个字符.
nchar(n)变量存储固定长度的Unicode字符串,该字符串恰好包含n个字符(因此,2*n个字节).它们的大小限制为4,000个字符.
varchar(n)变量存储由大约n个字符组成的非固定长度字符串.它们消耗l + 2个字节的空间,其中l是字符串的实际长度.它们的大小限制为8,000个字符.
我正在尝试学习Vanilla JavaScript或纯JS,但是你看看它.我开始学习jQuery,现在我试图在没有框架的情况下提高速度.我通常可以使用jQuery来获取它,但是使用纯JS很难做到这一点.
var a = $('.entry-content'),i;
for (i=0;i<a.length; i++) {
var b = a[i].innerHTML;
var c = document.createElement('div');
var d = c.id = 'reply_bb';
var e = d.innerHTML = 'Reply';
a[i].innerHTML = a[i].appendChild(c);
}
Run Code Online (Sandbox Code Playgroud)
基本上我想要做的是向var a元素添加一个元素.
<div class="entry-content">
<div>
Words from a poster or whatever would be in side here
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
在javascript =之后
<div class="entry-content">
<div>
Words from a poster or whatever would be in side here
</div>
<div id="reply_bb">Reply</div>
</div>
Run Code Online (Sandbox Code Playgroud)
因为这是相关的.在动态创建元素时,我会使用.click
或者.on('click',function() {
我将如何进行此操作?我想要它,所以当用户单击reply_bb时,它会附加刚刚隐藏的页面上的另一个元素.
var nothover = function(){window.setTimeout(function() {
$('#proFBfeel').hide();
$('#proFBfeel .moreinfos').html('');
$('.contact_pro').html('');
},3000);
};
$('#proFBfeel').nothover();
$('#proFBfeel').hover(function() {
window.clearTimeOut(nothover);
});
$('html').click(function() {
$('#proFBfeel').hide();
$('#proFBfeel .moreinfos').html('');
$('.contact_pro').html('');
});
Run Code Online (Sandbox Code Playgroud)
好的,正如您在我分配的内容中看到的,varnothover
是 setTimeout
三秒后,我希望该函数运行,除非该对象悬停。如果悬停则清除超时。
然后,一旦回到对象外部,再次运行该函数,或者除非他们单击 HTML 元素,然后隐藏该对象。
尽管它对我说,但它运行不正常
未捕获的类型错误:对象 [object Object] 没有方法“nothover”
为什么是这样?如果有人可以提供帮助,我将不胜感激。我所说的“帮助”是指解释一些 javascript 函数以及如何确保它们正常运行。
谢谢
我是JavaScript对象的新手,想知道我们是否可以在Object中运行JavaScript?这就是我想做的事情 -
$('.element').click(function () {
var data = $(this).attr('data-home');
if (data !== undefined) {
var jsRun = {
a: $('.more').show(),
b: $('.div').show(),
c: window.location = "www.url.com",
d: location.reload()
};
}
return jsRun[data];
});
Run Code Online (Sandbox Code Playgroud)
我写了返回jsRun因为我不太确定如果允许该怎么做以及如何让它运行我指定的代码.任何建议都会有所帮助
var a = function(bool){
(function b(bool){
if(bool === true || bool === undefined){
console.log('running');
setTimeout(b,50);
}else{
clearTimeout(b);
}
})();
}
Run Code Online (Sandbox Code Playgroud)
我已经知道这可能比setInterval
清除此功能更好.我已经尝试过休息和返回,并且它一直在循环console.log
有关如何轻松取消此功能的任何建议?
我试过的
if(bool === true || bool === undefined){
console.log('running');
setTimeout(b,50);
}else{
return;
}
var d;
if(bool === true || bool === undefined){
console.log('running');
d=setTimeout(b,50);
}else{
clearTimeout(d);
}
Run Code Online (Sandbox Code Playgroud)