English 中文(简体)
查找 Ing id 和 src 并添加到数组中
原标题:find the img id and src and adding to the array
  • 时间:2012-05-23 22:48:51
  •  标签:
  • javascript

这是我的 html 代码 :

<div id="cmdt_1_29d" class="dt_state2" onclick="sel_test(this.id)">
    <img id="cmdt_1_29i" onclick="dropit( cmdt_1_29 );"
         src="http://hitechpackaging.zes.zeald.com/interchange-5/en_US/ico_minus.png">
    <span class="dt_link">
        <a href="javascript://">CARTON &amp; BOARD</a>
    </span> 
</div> 
<div id="cmdt_2_31d" class="dt_istate1" onclick="sel_test(this.id)">
    <img src="/site/hitechpackaging/images/items/test.jpb ">
    <a href="https://secure.zeald.com/hitechpackaging/shop/CARTON%20%20%20%20BOARD/CORRUGATED%20%20CORNER%20BOARD?mv_pc=21497">CORRUGATED &amp; CORNER BOARD</a>
</div>

The dropit function modifies my img src which I dont want to, unfortunately I cant modify, Can I somehow read the data into array before it is being modified and that I can add the data back to the image.

问题回答

要删除点击处理器 :

var i = document.getElementById( cmd1_1_29i );
i.onclick = null;

或者,如果您仍想拨打最初点击处理器 :

var i = document.getElementById( cmd1_1_29i );
_onclick = i.onclick;

i.onclick = function(e) {
    // do what you want here
    _onclick && _onclick.apply(this, [e]);
}
​




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签