buildIMG = (src, resize) ->
html = <div class="left"><div class="foods_image">
html += <a onclick="popitup("http://somewhere.com/test" href="javascript:void(0)">
html += <img src=" +src+ " +resize+ />
html += </a>
html += </div></div>
html
popitup = (url) ->
newwindow=window.open(url, name , height=640,width=640 )
newwindow.focus() if window.focus
false
目前,我有一个书记册,将javascript代码(以上)插入网站。 我写了上述咖啡版,产生了以下结果:
(function() {
var buildIMG, popitup;
buildIMG = function(src, resize) {
var html, nbsp;
html = <div class="left"><div class="foods_image"> ;
html += <a onclick="popitup( http://somewhere.com/test );" href="javascript:void(0)"> ;
html += <img src=" + src + " + resize + /> ;
html += </a> ;
html += </div></div> ;
return html;
};
popitup = function(url) {
var newwindow;
newwindow = window.open(url, name , height=640,width=640 );
return newwindow.focus()(window.focus ? false : void 0);
};
}).call(this);
I snipped the functions that uses buildIMG. That function creates an overlay over the site and displays all images in that overlay. buildIMG is called for each image to create the html.
问题在于<代码>onclick=“popitup(”http://some where.com/test"t t work。 它没有定义。
A solution I did was to remove this which was generated by CoffeeScript:
(function() {
}).call(this);
一旦我撤走,就立即确定。 我怎么说,咖啡没有在我的 generated子里把这些话写进来?