Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Load applet in page on function call

    Hi, I'm making a page and I'd like to start an applet (Jmol) and display it near the button of the current page when a button is clicked. However, I get a syntax error: "missing ; before statement"
    (Note: this javascript is part of a cgi page)
    The code I have is as follow:
    Code:
    <script type="text/javascript" SRC="../jmol-12.0.48/Jmol.js"></script>
    <script 
    type="text/javascript" 
    language="Javascript">
    function loadJmol(SMILES)
    {
            document.getElementById("viewMol").innerHTML = 'jmolInitialize("../jmol-12.0.48", true); jmolAppletInline(300, \'\', "load \$' + SMILES + '");' ;
    }
    </script>
    ...
    print "<a href=javascript:loadJmol(\"SomeString\")>View</a>";
    print "<script id=\"viewMol\"></script>";
    The syntax error occurs at the single quote in ...").innerHTML = 'jmolInitialize("...

    I have been able to get this applet to run when not in a function.

    Has anyone run into this before and can give me a hand?

    Thanks, Tom
    Last edited by tomdbs98; 07-22-2011 at 10:13 PM. Reason: forgot to add something


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •