我一直试图改变我的画布的默认背景颜色,从黑色到透明/任何其他颜色 - 但没有运气.
我的HTML:
<canvas id="canvasColor">
Run Code Online (Sandbox Code Playgroud)
我的CSS:
<style type="text/css">
#canvasColor {
z-index: 998;
opacity:1;
background: red;
}
</style>
Run Code Online (Sandbox Code Playgroud)
正如您在下面的在线示例中所看到的,我在画布上附加了一些动画,所以不能只做一个不透明度:0; 在id上.
实时预览:http: //devsgs.com/preview/test/particle/
有任何想法如何覆盖默认黑色?
鉴于此功能:
function Repeater(template) {
var repeater = {
markup: template,
replace: function(pattern, value) {
this.markup = this.markup.replace(pattern, value);
}
};
return repeater;
};
Run Code Online (Sandbox Code Playgroud)
如何this.markup.replace()
全球更换?这是问题所在.如果我像这样使用它:
alert(new Repeater("$TEST_ONE $TEST_ONE").replace("$TEST_ONE", "foobar").markup);
Run Code Online (Sandbox Code Playgroud)
警报的值为"foobar $ TEST_ONE".
如果我更改Repeater
为以下内容,则Chrome中未替换任何内容:
function Repeater(template) {
var repeater = {
markup: template,
replace: function(pattern, value) {
this.markup = this.markup.replace(new RegExp(pattern, "gm"), value);
}
};
return repeater;
};
Run Code Online (Sandbox Code Playgroud)
......警报是$TEST_ONE $TEST_ONE
.
我有一个简单的添加属性函数:
$(".list-toggle").click(function() {
$(".list-sort").attr('colspan', 6);
});
Run Code Online (Sandbox Code Playgroud)
我的问题是:如何将其转换为切换,因此colspan="6"
在下一次单击时从元素中删除?
我没有找到这种情况的任何标准:
if ($a == $b && $b == $c && $c == $d && $g == $d) {
}
Run Code Online (Sandbox Code Playgroud)
要么
if (($a == $b && $b == $c) && ($c == $d && $g == $d)) {
}
Run Code Online (Sandbox Code Playgroud)
想象一下,var-names更长,超过80个字母.我该怎么处理?它可能看起来像:
if (
$a == $b
&& $b == $c
&& $c == $d
&& $g == $d
) {
}
Run Code Online (Sandbox Code Playgroud) 问题是,我有一个内容div,它在容器高度上伸展它的容器(容器和内容div有自动高度).
我想要背景容器,它是内容div的兄弟div来拉伸以填充容器.后台容器包含div以将背景分成块.
背景和容器div的宽度为100%,内容容器没有.
HTML:
<div id="container">
<div id="content">
Some long content here ..
</div>
<div id="backgroundContainer">
<div id="someDivToShowABackground"/>
<div id="someDivToShowAnotherBackground"/>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
#container {
height:auto;
width:100%;
}
#content {
height: auto;
width:500px;
margin-left:auto;
margin-right:auto;
}
#backgroundContainer {
height:100%;??? I want this to be the same height as container, but 100% makes it the height of the viewport.
}
Run Code Online (Sandbox Code Playgroud) 我正在动态填充带有选项的选择框.当我这样做时,我希望选择框的值是第一个选项的值(如果你愿意,可以选择'默认选项').听起来很简单,但我无法让它发挥作用.
var myElement = $('select[name="myName"]');
Run Code Online (Sandbox Code Playgroud)
....尝试了以下三种变化
// myElement.find('option').first().prop('selected', 'selected');
// myElement.val(myElement.find('options').first().val());
myElement.prop('selectedIndex', 0);
Run Code Online (Sandbox Code Playgroud)
...但是以下行给出了空白警报
alert(myElement.val());
Run Code Online (Sandbox Code Playgroud)
我哪里错了?
我正在开发一个应用程序(我的大学的一种社交网络).我需要添加注释(在特定数据库中插入一行).为此,我在html页面中有一个包含各种字段的HTML表单.在提交时我不使用表单的操作,但我在提交表单之前使用自定义javascript函数来详细说明一些数据.
function sendMyComment() {
var oForm = document.forms['addComment'];
var input_video_id = document.createElement("input");
var input_video_time = document.createElement("input");
input_video_id.setAttribute("type", "hidden");
input_video_id.setAttribute("name", "video_id");
input_video_id.setAttribute("id", "video_id");
input_video_id.setAttribute("value", document.getElementById('video_id').innerHTML);
input_video_time.setAttribute("type", "hidden");
input_video_time.setAttribute("name", "video_time");
input_video_time.setAttribute("id", "video_time");
input_video_time.setAttribute("value", document.getElementById('time').innerHTML);
oForm.appendChild(input_video_id);
oForm.appendChild(input_video_time);
document.forms['addComment'].submit();
}
Run Code Online (Sandbox Code Playgroud)
最后一行将表单提交到正确的页面.它工作正常.但我想使用ajax提交表单,我不知道如何做到这一点,因为我不知道如何捕获表单输入值.有人可以帮帮我吗?
我正在创建一个PHP框架,我有些疑惑......
框架以这种方式获取URL:
http:/web.com/site/index
它需要第一个参数来加载controller(site
)然后加载特定的动作(index
).
如果您已经在基本URL中安装了框架,则可以正常工作,但如果您将其安装在如下的子文件夹中:
http://web.com/mysubfolder/controller/action
我的脚本将其解析为controller = mysubfolder
和action = controller
.
如果你有更多的子文件夹,结果将是最糟糕的.
这是我的路线代码:
Class Route
{
private $_htaccess = TRUE;
private $_suffix = ".jsp";
public function params()
{
$url='';
//nombre del directorio actual del script ejecutandose.
//basename(dirname($_SERVER['SCRIPT_FILENAME']));
if($this->_htaccess !== FALSE):
//no está funcionando bien si está en un subdirectorio web, por ej stynat.dyndns.org/subdir/
// muestra el "subdir" como primer parámetro
$url = $_SERVER['REQUEST_URI'];
if(isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])):
$url = str_replace("?" . $_SERVER['QUERY_STRING'], '',$url);
endif;
else: …
Run Code Online (Sandbox Code Playgroud) 就像LinkedIn前三个屏幕一样
- 溅
- 登录/注册按钮
- 登录/注册表格
所有都具有与背景相同的图像,但是当我们从一个活动移动到另一个活动时,背景图像从右侧滚动到左侧.
我只能尝试,overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
但这不是它的样子.
如何在提交按钮单击后重定向用户?我的javascript无效:
使用Javascript
<script type="text/javascript" language="javascript">
function redirect()
{
window.location.href="login.php";
}
</script>
Run Code Online (Sandbox Code Playgroud)
表单页面
<form name="form1" id="form1" method="post">
<input type="submit" class="button4" name="order"
id="order" value="Place Order" onclick="redirect();" >
</form>
Run Code Online (Sandbox Code Playgroud) javascript ×4
jquery ×3
css ×2
php ×2
ajax ×1
android ×1
canvas ×1
convention ×1
frameworks ×1
height ×1
html ×1
html5 ×1
html5-canvas ×1
regex ×1
replace ×1
routes ×1
three.js ×1
url ×1