2010-12-07 3 views
0

これで何時間も何も動作しないようです。助けてください!追加/前にonclickが機能しない(HELP PLS)

<table id='options_table'> 
<tr><td colspan=3><font size="3" class="colors_productname"> 
<i><b><font size=2>(NEED TO INSERT CODE 1 HERE) STEP 1: (NEED TO INSERT CODE 2 HERE)<font color=red>*</b></i> 
</font> 
<br /><table cellpadding="0" cellspacing="0" border="0"><tr><td><img src="/images/Line_Group_Features.gif" /></td></tr></table> 
</font></td></tr> 
<tr> 
<td align="right" vAlign="top"> 
<img src="/images/clear1x1.gif" width="1" height="4" border="0"><br /> 
</td><td></td><td> 

<br><br /></td></tr> (NEED TO INSERT CODE 3 HERE) 
<tr><td colspan=3><font size="3" class="colors_productname"> 
<i><b><font size=2>STEP 2:</b></i> 
</font> 
<br /><table cellpadding="0" cellspacing="0" border="0"><tr><td><img src="/images/Line_Group_Features.gif" /></td></tr></table> 
</font></td></tr> 
<tr> 
.... 
:このテーブルに </div>

CODE 1:<div onclick="openClose('stp1')" style="cursor:hand; cursor:pointer">

CODE 2:</div><div id="stp1" class="texter">

CODE 3

私はコードのこれらの3セットを挿入する必要があります

I'v

$("img[src$='Line_Group_Features.gif']:eq(0)").closest('font').prepend('<div onclick="openClose(\'stp1\')" style="cursor:hand; cursor:pointer">'); 
$("img[src$='Line_Group_Features.gif']:eq(0)").closest('font').append('</div><div id="stp1" class="texter">'); 
$("img[src$='Line_Group_Features.gif']:eq(1)").prev('tr'):eq(.append('</div>'); 

と、この:

$("img[src$='Line_Group_Features.gif']:eq(0)").closest('font').prepend('<div id="clickstp1" style="cursor:hand; cursor:pointer">'); 
$("img[src$='Line_Group_Features.gif']:eq(0)").closest('font').append('</div><div id="stp1" class="texter">'); 
$("img[src$='Line_Group_Features.gif']:eq(1)").closest('font').prepend('</div>'); 
$('#clickstp1').bind('click', function()) { openClose('stp1');}); 

何もの作業eがこれを試してみました。

答えて

1

あなたがこれを行うことができるようになります。

$("img[src$='Line_Group_Features.gif']:eq(0)").before('<div onclick="openClose(\'stp1\')" style="cursor:hand; cursor:pointer">'); 
$("img[src$='Line_Group_Features.gif']:eq(0)").after('</div><div id="stp1" class="texter">'); 
+0

代わりに 'wrap'を使用してはいけません...前/後に追加/前置詞を追加します。テキストノードとしてHTMLを追加するか、完全ノードを使用しない場合はdomをボットしますか?また、 'font'はhtml要素です。それは彼の例です。 – prodigitalson

+1

後でフォントを見ました(初めて見逃しました)。 Wrapは、コードにいくつかの変更を加えることができます。私はそこから行く方法を彼に示すために、少なくとも変更を加えようとしました。あなたは正しいですが、ラップは良いです。もし、彼が要素を完成すれば、彼は大丈夫だろう。 –

1

私は、これはあなたが挿入が正しいので、取得してもあなたのために働くために起こっていると思ういけない:

  1. fontはかなり確信してイムインライン要素のようにブロックレベル要素を含めることはできませんdiv
  2. divはまたはthの外部では無効です/tbody/thead
関連する問題