我遇到的參數傳遞中 雙引號單引號嵌套問題

來源:互聯網
上載者:User

最近學vml::cakepie.innerHTML="<v:shape id='cake"+(i+1)+"'type='#Cake_3D'"+
" style='position:absolute;left:"+(_left + Height / 8)+"px;top:"+(_top + Height / 24)+"px;WIDTH:"+Height+"px;HEIGHT:"+Height+"px;rotation:"+rotates+";z-index:"+zIndex+"' adj='"+adjs+",0'"+
"stroked='false' fillcolor='"+this.Cakes[i][2]+"' onclick='moveCake(cake"+(i+1)+",rec"+(i+1)+")' onmouseover='moveover(\""+this.Cakes[i][0]+"\","+this.Percent[i]+")' onmouseout='moveout()'>"+
"<v:fill opacity='60293f' color2='fill lighten(120)' o:opacity2='60293f' rotate='t' angle='-135' method='linear sigma' focus='100%' type='gradient'/>"+
"<o:extrusion v:ext='view' on='t' backdepth='16' rotationangle='60' viewpoint='0,0'viewpointorigin='0,0' skewamt='0' lightposition='-50000,-50000' lightposition2='50000'/>"+
"</v:shape>";

其中紅色部分的moveover函數第一個參數是 cake的名字,由於本身在一個雙引號的字串裡面, 開始時候是這麼寫的:onmouseover='moveover("+this.Cakes[i][0]+","+this.Percent[i]+")'

在moveover函數中怎麼也擷取不到this.Cakes[i][0]的值。 後來在兩邊加了單引號onmouseover='moveover(‘"+this.Cakes[i][0]+"',"+this.Percent[i]+")' 還是不行,最後 用轉譯斜杠+雙引號(藍色部分)解決了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.