点击按钮调用函数显示div mac_1,然后点击运行按钮点击函数调用三次,如何通过div id设置if条件
$("#run").click(function() {$('#resultFrame').contents().find('html').html("<style>" + $('#css').val() + "</style>" + $("#html").val());
document.getElementById('resultFrame').contentWindow.eval($('#js').val());
else if
{
$('#resultFrame1').contents().find('html').html("<style>" + $('#css').val() + "</style>" + $("#html").val());
document.getElementById('resultFrame').contentWindow.eval($('#js').val());
}
else
{
$('#resultFrame3').contents().find('html').html("<style>" + $('#css').val() + "</style>" + $("#html").val());
document.getElementById('resultFrame').contentWindow.eval($('#js').val());
点击按钮调用div
<div class="mac_1" id="mac_1" >
<iframe id="resultFrame" height="100%" width="100%">
<p>Your browser does not support iframes.</p>
</iframe>
</div>
<div class="ipad_1" id="ipad_1" style=" display: none;">
<iframe id="resultFrame1" height="100%" width="100%">
<p>Your browser does not support iframes.</p>
</iframe>
</div>
<div class="mob_1" id="mob_1" style=" display: none;">
<iframe id="resultFrame3" height="100%" width="100%">
<p>Your browser does not support iframes.</p>
</iframe>
</div>
最佳答案
那应该行得通。也许 capturePhoto()
有错误?插入 alert()
或 console.log():
if ( photo=="yes" )
{
alert("Thank you StackOverflow, you're a very big gift for all programmers!");
capturePhoto();
}
else
{
alert("StackOverflow.com must help me!");
}
关于javascript - 调用函数时如何设置if条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32350022/