0

I get this error:

Uncaught SyntaxError: missing ) after argument list

with this code:

<script>
  function go(location) {
    alert(location);
    document.getElementById('main_frame').src = location;
  }
</script>
<header class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="navbar-header">
         <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a href="#" class="navbar-brand">Pier Capitan</a>
            <nav class="collapse navbar-collapse" role="navigation">
                <ul class="nav navbar-nav">
                    <?php foreach($links as $link){ ?>
                        <li>
                            <a href="#" onclick="go(<?php echo base_url().$link->link_address ?>)"><?php echo strtoupper($link->link_address) ?></a>
                        </li>
                    <?php } ?>
                </ul>
            </nav><!-- end of navbar collapse -->
    </div><!-- end of navbar header -->
</header>
<br><br><br><br><br><br>
<div class="col-md-12">
<iframe src="about:blank" id="main_frame" height="500" width="100%" frameborder="0"></iframe>
</div>

I just need to pass the link to the "go" script so I can change the source of the iframe.

1 Answer 1

1
<a href="javascript:void(0)" onclick="go('<?php echo base_url().$link->link_address ?>')"><?php echo strtoupper($link->link_address) ?></a>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.