我想在mozilla画布中实现一个绘图窗格(与visio为流程图提供的类似但更小的版本).
这有什么支持吗?
到目前为止,我一直使用jQuery来创建矩形并移动它们.虽然这很容易.创建线条(对象之间的连接)是一个真正的痛苦.我在javascript中使用一些粗略的方式逐像素地着色它既不好看也不可扩展,而且我需要构建很多函数来使连接坚持一组对象等.
有谁知道画布和那里可用的功能是否会让我的生活更轻松.
在这种情况下,指向什么是更好的解决方案.(我希望它不是小程序)
提前致谢.
我用msDropDown转换的<select>,以<ul>列出语言切换.但问题是,使用这个jQuery插件,选择页面加载后需要很长时间才能加载.
那么,我怎样才能使用ul列表而不是select?
这是我的选择代码:
<select name="lang" class="language" onchange="location.href='index.php?lang='+this.value+''.$trackpage.'">
<option name="lang" data-image="style/lang/de.png" value="de">Deutsch</option>
<option name="lang" data-image="style/lang/en.png" value="en" selected="selected">English</option>
<option name="lang" data-image="style/lang/es.png" value="es">Espanol</option>
<option name="lang" data-image="style/lang/fr.png" value="fr">Francais</option>
<option name="lang" data-image="style/lang/it.png" value="it">Italiano</option>
</select>
Run Code Online (Sandbox Code Playgroud)
我尝试过:
<ul onchange="location.href='index.php?lang='+this.value+'">
<li>
<a href="" name="lang" data-image="style/lang/de.png" value="de">English</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
但value并onchange没有得到ul和支持a.
有没有办法ul使用select属性?
谢谢!抱歉我的英语不好!
我在我的扩展程序中实现了一个简单的Facebook"赞"按钮.但是,它似乎没有起作用.
我正在使用iframe"喜欢"按钮的版本,因为我不需要任何额外的脚本.
<iframe src="//www.facebook.com/plugins/like.php?href=[dummy_text]&send=false&layout=button_count&width=100&show_faces=false&font&blah..." scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
Run Code Online (Sandbox Code Playgroud)
首先,按钮确实显示正确和正确:

但是,单击它后,它将以红色显示"错误":

所以我想也许是因为清单版本2中添加了(一种愚蠢的)限制策略?因为如果我把它放在常规网页上就可以了.(单击"赞"按钮后显示"确认".)

有关如何解决此问题的任何想法?
我在尝试获取所选对象而不是传递给成功回调的"newValue"时遇到问题.
这是一个例子:
$("select").editable({
type : "select",
title: 'Select Fruit',
source : [
{text : "Apple", value: "option_1"},
{text : "Orange", value: "option_2"},
{text : "Mango",value: "option_3"},
{text : "Strawberry",value: "option_4"}
],
success:function(response,newValue){
console.log(newValue); // newValue contains the "text" string ok..
// How do I get the selected source object? eg. {text : "Orange", value: "option_2"}
// So I can access the object like..
console.log(newValue.value); // output option_*
}
});
Run Code Online (Sandbox Code Playgroud)
谢谢卡尔
(function(){
//something here...
})() <--//This part right here.
Run Code Online (Sandbox Code Playgroud)
究竟是什么)()?
如果我改成它())怎么办?
(function(){
//something here...
}()) <--//Like this
Run Code Online (Sandbox Code Playgroud) Google文档如何全面使用JavaScript?
在Google文档演示文稿中,当您按下fullscreen窗口左下角的按钮时,窗口将全屏显示.
它不是Flash,所以我很好奇谷歌怎么做到这一点?
请注意,它不会创建适合屏幕的大窗口(这是假全屏).它实际上处于fullscreen模式状态,谷歌Chrome要求我的许可.
popState当网址发生变化(向后或向前)时,将触发该事件.最近我注意到,例如,在http://www.example.com/:
<a href="#anchor">Top</a>
Run Code Online (Sandbox Code Playgroud)
也将触发popState,导致页面"重新加载".
我怎么知道如果它是相同的URL并且只有#部分发生了变化?
$(window).bind("popstate",function(){
swap(location.href);
})
Run Code Online (Sandbox Code Playgroud)
在该示例中,当您单击"顶部"链接(见上文)时,页面将转到#anchor,但它也会触发popState并导致重新加载,这是我不期望的.
所以我做的是这样的:
{{someFlag ? "<b>Bold Text</b>" : "<i>Italic Text</i>"}}
Run Code Online (Sandbox Code Playgroud)
但众所周知,事情并不总是那么顺利.当我在内联代码中包含"标记"时,AngularJS似乎完全忽略了整个事物并呈现了源代码.
我试过了
"\<b>.....
Run Code Online (Sandbox Code Playgroud)
和
"<b>...
Run Code Online (Sandbox Code Playgroud)
但他们都没有用.任何的想法?
这个问题困扰了我很长一段时间.对不起,如果这是一个愚蠢的问题.
以前,我知道你可以获得带有类名的元素
document.body.getElementsByClassName("foo");
Run Code Online (Sandbox Code Playgroud)
我是如此懒惰,所以我只是将代码复制并粘贴到另一部分来执行此操作
document.body.getElementById("bar");
Run Code Online (Sandbox Code Playgroud)
我不小心发现它不起作用.我测试了,它说
TypeError:Object#<HTMLBodyElement>没有方法'getElementById'
那么,为什么它有getElementsByClassName和getElementsByTagName和所有那些类似的方法,但只是没有getElementById?
typeof document === typeof document.body //true
Run Code Online (Sandbox Code Playgroud)
他们的类型是相同的,所以他们应该有相同的东西.但这似乎并非如此.
我想和JavaScript一样,.toString(16)但是在PHP中:
var n = 200000002713419;
console.log(n.toString(16));
Run Code Online (Sandbox Code Playgroud)
这回来了b5e6211de74b.我怎样才能用PHP实现同样的目标?
非常感谢.