我在表中有很多行数据,我试图看看是否可以在鼠标悬停时同时突出显示两行.
我可以做点什么
<tr onmouseover="this.style.backgroundColor='#aaaaaa';" onmouseout="this.style.backgroundColor='#bbbbbb';">
它适用于一次一行,但显示的数据是"配对",如下所示.第1行,第2行,第3行和第4行.所以我想看看是否可以在任一行区域中鼠标悬停时同时突出显示第1行和第2行.然后同样为3和4.
<tr><td>Row1</td></tr>
<tr><td>Row2</td></tr>
<tr><td>Row3</td></tr>
<tr><td>Row4</td></tr>
假设我们上课了Employee.我想要一个引用同一个类的不同实例的字段.
怎么写这个?以下代码怎么样?
ref_employee= models.ForeignKey('self',null=True,blank=True)
Run Code Online (Sandbox Code Playgroud) public class Animal{
int n = 5;
public static void main(String[] args) {
Animal a = new Animal();
Animal ah = new Horse();
Horse h = new Horse();
System.out.println(h.n); // prints 7
System.out.println(ah.n); // prints 5
h = (Horse) ah;
System.out.println(h.n); // prints 7
}
}
class Horse extends Animal{
int n = 7;
}
Run Code Online (Sandbox Code Playgroud)
为什么h.n还要打印7 h = (Horse) ah?在赋值之后它应该指向同一个ah点,n字段指向5?
我试图找到列中的第二大值,只有第二大值.
select a.name, max(a.word) as word
from apple a
where a.word < (select max(a.word) from apple a)
group by a.name;
Run Code Online (Sandbox Code Playgroud)
出于某种原因,我现在所返回的第二大值和所有较低的值也是幸运的,但幸运的是避免了最大值.
有没有办法来解决这个问题?
我想做点什么
<bean id="xxx" class="yyy">
<property name="list">
<list>
<ref bean="bean1" />
<ref bean="bean2" />
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
bean"bean1"和"bean2"是接口I的两种不同实现.但是,它们属于不同的类.有谁知道我怎么做到这一点?我构建一个字符串列表和一个整数列表没有问题.为什么我不能构建一个bean列表?
谢谢,
ktm
我发现这篇文章:
http://www.zurb.com/article/221/css3-animation-will-rock-your-world关于css3动画.
我试图在上面的网站上创建一个类似的效果,但在个人网站上:www.imfrom.me
我有缅因州,有红色尖盒.我想通过指示位置的箭头创建一个脉冲环.
更新代码:
我在下面提出了这个问题(在这里试试:http://jsfiddle.net/ftrJn/),因为你可以告诉它,我对如何从中心发展它有任何想法:
.gps_ring {
border: 3px solid #999;
-webkit-border-radius: 30px;
height: 18px;
width: 18px;
position: absolute;
left:20px;
top:214px;
}
.gps_ring{
-webkit-animation-name: pulsate;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite
}
@-webkit-keyframes pulsate {
0% { width:1px;height: 1px; opacity: 0.0}
10% { width:3px;height: 3px; opacity: .20}
20% { width:5px;height: 5px; opacity: .40 }
30% { width:7px;height: 7px; opacity: .60 }
40% { width:9px;height: 9px; opacity: .80 }
50% { width:11px;height: 11px; opacity: 1.0} …Run Code Online (Sandbox Code Playgroud) 我使用这个Facebook登录按钮代码:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : 'myActualId',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
<fb:login-button show-faces="false" width="200" max-rows="1"></fb:login-button>
Run Code Online (Sandbox Code Playgroud)
但是调试控制台给了我这个错误:在调用FB.init()之前调用了FB.login().
我做了一个测试页面,所以可以看到我的错误:http: //www.comehike.com/test_fb_connect.php
我不知道我做错了什么.任何帮助将非常感激!
谢谢,亚历克斯
我知道为此目的使用DOM会更好,但让我们尝试以这种方式提取文本:
<?php
$html=<<<EOD
<html>
<head>
</head>
<body>
<p>Some text</p>
</body>
</html>
EOD;
preg_match('/<body.*?>/', $html, $matches, PREG_OFFSET_CAPTURE);
if (empty($matches))
exit;
$matched_body_start_tag = $matches[0][0];
$index_of_body_start_tag = $matches[0][1];
$index_of_body_end_tag = strpos($html, '</body>');
$body = substr(
$html,
$index_of_body_start_tag + strlen($matched_body_start_tag),
$index_of_body_end_tag - $index_of_body_start_tag + strlen($matched_body_start_tag)
);
echo $body;
Run Code Online (Sandbox Code Playgroud)
结果可以在这里看到:http://ideone.com/vH2FZ
如您所见,我收到的文字多于预期.
有一些我不明白的东西,为了获得substr($string, $start, $length)函数的正确长度,我正在使用:
$index_of_body_end_tag - $index_of_body_start_tag + strlen($matched_body_start_tag)
Run Code Online (Sandbox Code Playgroud)
我没有看到这个公式有什么问题.
有人可以建议问题出在哪里吗?
非常感谢大家.
编辑:
非常感谢你们所有人.我脑子里只有一个小虫.在阅读完答案后,我现在明白了问题所在,它应该是:
$index_of_body_end_tag - ($index_of_body_start_tag + strlen($matched_body_start_tag));
Run Code Online (Sandbox Code Playgroud)
要么:
$index_of_body_end_tag - $index_of_body_start_tag - strlen($matched_body_start_tag);
Run Code Online (Sandbox Code Playgroud) 我已经实现了一个新的Web应用程序,它使用ASP.NET MVC3中的默认成员资格系统.
但是,如果要开始存储有关这些注册用户的其他信息,我该怎么办?
假设我想为每个用户存储"fav color",这种情况下的最佳做法是什么?
我确实查看了建议的"相关问题",但发现这些问题更适合于webforms,或者只是处于我无法理解的水平......
谢谢保罗
我正在阅读vim的字节.这是我遇到的一个问题.
我在macosx中使用vim.(命令行不是GUI)
在书中,"想让窗户再次高度相同"?按ctrl-w =" 我试过了,但它没有用.而且,它发出一些声音(我相信它表明存在错误)
另外,当我查看关于窗口的mac vim帮助页面时,我确实找到了这个命令.我再试一次---仍然无法在命令行模式下工作,但它确实在GUI模式下工作(MacVim)
有没有人有任何想法来解决这个问题?非常感谢!