先生, 我需要使用jQuery的标签td
,tr
和div
包含onmouseout
和onmouseover
添加元素添加属性。的jQuery中的元素TR,TD和DIV
如果发现onmouseout="ANY FUNCTION"
然后我需要添加属性onblur="SAME FUNCTION AS onmouseout"
。
那么,如果发现onmouseover="Any Function"
然后我需要添加属性onfocus="sane functions as onmouseover"
。
此功能包含在标签td, tr or div
。
如TD:
<td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(this)" id="zz1_GS">
然后我需要:
<td onmouseover="Menu_A(this)" onfocus="Menu_A(this)" onmouseout="Menu_Unhvr(this)" onblur="Menu_Unhvr(this)" onkeyup="Menu_Key(this)" id="zz1_GS">
例TR:
<tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(this)" id="zz86756f">
那么我需要像这样:
<tr onmouseover="MDynamic(this)" onfocus="MDynamic(this)" onmouseout="Menu_r(this)" onblur="Menu_r(this)" onkeyup="Menu_Ky(this)" id="zz86756f">
例格:
<div class="1_5656" id="d867444f" onmouseover="PopOUp(this)" onmouseout="PopOStop(this)" style="text-align:center;">
然后我需要的东西是这样的:
<div class="1_5656" id="d867444f" onmouseover="PopOUp(this)" onfocus="PopOUp(this)" onmouseout="PopOStop(this)" onblur="PopOStop(this)" style="text-align:center;">
ID名称不一样而td和tr的水平并不一致。
谁能帮我实现这一目标?
我做这个代码,但它不工作:
$('div[onmouseout]').each(function() {
$(this).attr('onblur', $(this).attr('onmouseout'));
}
$('div[onmouseover]').each(function() {
$(this).attr('onfocus', $(this).attr('onmouseover'));
}
$('tr[onmouseout]').each(function() {
$(this).attr('onblur', $(this).attr('onmouseout'));
}
$('tr[onmouseover]').each(function() {
$(this).attr('onfocus', $(this).attr('onmouseover'));
}
$('td[onmouseout]').each(function() {
$(this).attr('onblur', $(this).attr('onmouseout'));
}
$('td[onmouseover]').each(function() {
$(this).attr('onfocus', $(this).attr('onmouseover'));
}
你试过了什么? 。 – Vladimirs 2013-04-05 14:34:06
令人困惑的问题,不能ü阐述:( – dreamweiver 2013-04-05 14:34:26
请不要使用'onwhatever'属性触发JavaScript的它更容易,从长远来看,要添加使用['。对()']的处理程序(HTTP:// API .jquery.com/on) – Blazemonger 2013-04-05 14:35:59