我试图传递document.write作为变量的引用:
例:
var f = document.write
//then
f('test');
Run Code Online (Sandbox Code Playgroud)
它适用于警报.为什么不兼容document.write?
如果我想使用可成本化的div,我应该使用哪种doctype.使用div动画,移动图像,设置div不透明度等.
我试图通过javascript创建一个div,设置它的背景颜色,位置,宽度和高度,并添加一个onmouseover事件.
一切正常,直到我想在我的HTML上添加doctype.
我尝试了过渡和严格,都使我的div消失了.
所以我插入了HTML5类型的doctype,我的div显示正常.
好吧,我想用html4制作我的网站.
可能吗?
这是代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
Run Code Online (Sandbox Code Playgroud)
我觉得这里有一个问题:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type='text/javascript'>
function run(){
var div = document.createElement('div')
div.style.position = 'absolute'
div.style.left = '0px'
div.style.top = '0px'
div.onmouseover=function(){
alert('mo')
this.style.opacity = 0
}
div.style.width = '30px'
div.style.height = '30px';
div.style.backgroundColor = '#000'
document.body.appendChild(div)
}
onload = run
</script>
<title></title>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我还需要插入或编辑什么,以便我的代码在代码验证器中完全正常?谢谢 :)
我正在尝试将带有INSERT INTO MySQL命令的heredoc语法用于数据库.
我面临的问题是变量$tPerson_SQLinsert,这是一个查询.
这是我的代码:
$tPerson_SQLinsert = <<<SQL
INSERT INTO tPerson (Salutation, FirstName, LastName, Tel, companyID)
VALUES ("$Salutation", "$FirstName", "$LastName", "$Tel", "$companyID")
SQL;
Run Code Online (Sandbox Code Playgroud)
好吧,这个语法可能有问题.
因为我得到了这个Parse错误:
Parse error: syntax error, unexpected end of file in F:\wamp\www\forms\personInsert.php on line 83
Run Code Online (Sandbox Code Playgroud)
这只是php的结束标记?>.
heredoc的正确语法是什么?
谢谢.
谁能告诉我为什么我的'showDiv_boo'在类的方法中未定义?我也无法访问我班级的方法.
这是我的类'Blink'类及其属性和方法:
function Blink(div) {
this.div = div
}
Blink.prototype.counter = 0
Blink.prototype.showDiv_boo = true
Blink.prototype.showDiv = function() {
this.div.style.visibility = 'visible'
}
Blink.prototype.hideDiv = function() {
this.div.style.visibility = 'hidden'
}
Blink.prototype.startEngine = function() {
if (this.showDiv_boo) {
this.showDiv()
} else if (!this.showDiv_boo) {
this.hideDiv()
}
this.showDiv_boo = !this.showDiv_boo
this.counter++
}
Blink.prototype.startEffect = function() {
this.idEffect = setInterval(this.startEngine, 1000 / 45)
}
Run Code Online (Sandbox Code Playgroud)
所以,如果我创建:
_blink = new Blink(myDiv);
_blink.startEffect();
Run Code Online (Sandbox Code Playgroud)
你可以测试......变量'showDiv_boo',在方法中是未定义的.
即使如果我将方法中的showDiv_boo设置为true,它也不会调用我的类的方法showDiv或hideDiv.
任何人?
谢谢 :)
我该怎么办:
沿着路径(其他动画片段)附加动画片段(例如"脚步声").
这将在一次附加一个动画片段的间隔内.
我需要旋转,即脚步,应该根据路径方向旋转.
谢谢.
假设我有一个数组,用于存储我用于setInterval.
如果我想动态创建一个 id 怎么办……我可以这样做吗?
id_array.push(++id_var) = setInterval(function, milliseconds);
Run Code Online (Sandbox Code Playgroud)
看?
我还有一个名为“id_var”的变量,我相信,如果我增加它,它会给我一个新的“id”。
这段代码正确吗?
如何用新值替换多维数组中的字符串/单词?我没有它的钥匙,只知道大海捞针和针。
假设我有一个多维数组,,$submenu_arr(不知道有多少维)。
我想在这些数组之一中找到一个值并将其替换为新值。
其实是为了翻译。
喜欢:
recursive_arr_translation('Article', $submenu_arr, 'Artigo');//"Artigo" is a Portuguese word for "Article".
Run Code Online (Sandbox Code Playgroud)
我试过这个,但不起作用:
function in_array_r($needle, $haystack, $new_value) {
$found = false;
foreach ($haystack as $key=>$value) {
if ($value === $needle) {
$found = true;
$haystack[$key] = $new_value;
return true;
} elseif (is_array($value)) {
$found = in_array_r($needle, $haystack[$key], $new_value);
if($found) {
return true;
}
}
}
return $found;
}
in_array_r('Article', $submenu, 'Artigo');
in_array_r('Location', $submenu, 'Localização');
Run Code Online (Sandbox Code Playgroud)
编辑:正在工作,但不知何故,我无法正常工作,我正在尝试翻译 WordPress 子菜单词。
这是我的HTML:
<!DOCTYPE html>
<html>
<head>
<script>
function run(){
var div = document.createElement('div')
div.style.position = 'absolute'
div.style.left = 0
div.style.top = 0
div.onmouseover=function(){
alert('mo')
this.style.opacity = 0
}
div.style.width = 30
div.style.height = 30
div.style.backgroundColor = '#000'
document.body.appendChild(div)
}
onload = run
</script>
<title></title>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这个hmtl在怪癖模式下运行正常.但是,我知道我需要为html使用其他一些标签.
我想知道... 1 - 我应该添加哪些其他标签,所以它在代码验证器中运行正常?
2 - 为什么我的javascript不能使用html5 doctype?(它在怪癖模式下工作正常)
谢谢 :)
如何通过AS3按钮组件命名?
我有3个按钮组件:BackButton,ForwardButton和PlayButton.
我已通过属性面板命名它们(其中显示"实例名称").
但是一旦我点击它们并检查我收到的event.target.name,总是'button_mc'.
我怎么能命名按钮?