这是我的代码
echo'
<td class="success"><button id="btn-Preview-Image" class="btn btn-success" name="sure" onClick="PrintElem('.'mydiv'.$row['id'].''.');">print</button></td>
';
像这样打印的onclick方法
onClick="PrintElem(mydiv12);"
但是我想要这样一个引号
onClick="PrintElem('mydiv12');"
答案 0 :(得分:1)
尝试将双引号引起来
echo '<td class="success">
<button id="btn-Preview-Image" class="btn btn-success" name="sure"
onClick="PrintElem(' . "'mydiv".$row['id'] ."'" . ');">print</button>
</td>';
答案 1 :(得分:1)
这可以通过添加和转义单引号来实现:
public class BitmapWebView extends WebView{
private void init(){
stream = new ByteArrayOutputStream();
array = new ReadData(new byte[]{});
bm = Bitmap.createBitmap(outputWindowWidth,
outputWindowHeight, Bitmap.Config.ARGB_8888);
bmCanvas = new Canvas(bm);
}
@Override
public void draw( Canvas ){
// draw onto a new canvas
super.draw(bmCanvas);
bm.compress(Bitmap.CompressFormat.PNG, 100, stream);
array.Buffer = stream.toByteArray();
UnityBitmapCallback.onFrameUpdate(array,
bm.getWidth(),
bm.getHeight(),
canGoBack,
canGoForward );
stream.reset();
}
}
// you need this class to communicate properly with unity
public class ReadData {
public byte[] Buffer;
public ReadData(byte[] buffer) {
Buffer=buffer;
}
}
结果(来自HTML来源):
RawImage
旁注:这是另一种方式。发布此消息时,我没有看到(其他)答案。