I have a bunch of java-script in one page. Working (this time :) )
When I add the following simple code everything stops working, is there a small type or something I am missing?
if(document.getElementById('checkBottom').checked)
{
document.getElementById('preview_hl_front').src = "./assets/images/bottom---highligt-front.png";
{
else
{
document.getElementById('preview_hl_front').src = "./assets/images/highligt-front.png";
}
Other components:
<input type="checkbox" name="bottom" id="checkBottom" value="yes" data-preview="preview_bottom" onclick="validate()">
<div class="panel panel-default">
<div id="preview">
<img src="./assets/images/highligt-front.png" id="preview_hl_front" />
</div>
</div>
You have a typo. you closed the if
block with {
instead of }
Change this:
if(document.getElementById('checkBottom').checked)
{
document.getElementById('preview_hl_front').src = "./assets/images/bottom---highligt-front.png";
{
To this:
if(document.getElementById('checkBottom').checked)
{
document.getElementById('preview_hl_front').src = "./assets/images/bottom---highligt-front.png";
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.