title: Calling function and passing parameters to iframe from parent
body: <p>I am trying to call a function and pass a parameter to a iframe javascript function from the parent.</p>
  
  <p>I have</p>
  
  <pre><code>document.getElementById('iframeD').contentWindow.detect(name);
  </code></pre>
  
  <p>in my parent javascript</p>
  
  <p>in my iframe..if I have</p>
  
  <pre><code>function detect(name){
  
     console.log(name);
  }
  </code></pre>
  
  <p>it will gives me </p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token name
  </code></pre>
  
  <p>However, if I only call the function without parameter</p>
  
  <pre><code>document.getElementById('iframeD').contentWindow.detect();
  </code></pre>
  
  <p>and make my iframe function </p>
  
  <pre><code>function detect(){
  
     console.log('I want to pass the pare');
  }
  </code></pre>
  
  <p>it will works.</p>
  
  <p>What can I do to solve this? Thanks for the help!!!</p>