1

I am working on a page that contains a digital phone directory. The names and numbers are listed, but I would like for more details about the entry to display in a popup when the name is clicked. Unfortunately, I am having a problem with the Javascript. I am very new to this language, but I think that either the code within the function I declared is wrong, the syntax of the argument I am passing is incorrect, or I omitted an essential part of the code. Any assistance you can provide on this issue would be greatly appreciated.

<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
Function DisplayContactDetail(contact, windowname) {
    window.open(contact, windowname);
}
</script>
<title>Cigna Security & Reception Phone Directory</title>
</head>
<body>
    <div class="centerelement">
        <div id="indexpageheader">
            CIGNA SECURITY & RECEPTION DIGITAL PHONE DIRECTORY
        </div>
    </div>
    <table>
        <th colspan=2 width="auto">
            ALLIEDBARTON
        </th>
        <tr>
            <td width="50%">
                <a href="" onclick="DisplayContactDetail('cigna.com','ContactDetail')">
                    NEPA District Office
                </a>
            </td>
            <td>(610) 954-8590</td>
        </tr>
        <tr>
            <td width="50%">Post Watch</td>
            <td>(800) 643-8714</td>
        </tr>
    </table>

Thanks in advance!

5
  • So, what's the problem? Nothing happens? Getting unexpected results? An error occurs? Commented Jul 21, 2013 at 17:06
  • Nothing happens when I click on hyperlink. Commented Jul 21, 2013 at 17:07
  • <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <script> Function DisplayContactDetail (contact,windowname) { window.open (contact,windowname); } </script> <title>Cigna Security & Reception Phone Directory</title> </head> <body> <div class="centerelement"><div id="indexpageheader">CIGNA SECURITY & RECEPTION DIGITAL PHONE DIRECTORY</div></div> Commented Jul 21, 2013 at 17:23
  • <table> <th colspan=2 width="auto">ALLIEDBARTON</th> <tr> <td width="50%"><a href="" onclick="DisplayContactDetail('cigna.com','ContactDetail')">NEPA District Office</a></td><td>(610) 954-8590</td> </tr> <tr> <td width="50%">Post Watch</td><td>(800) 643-8714</td> </tr> </table> Commented Jul 21, 2013 at 17:24
  • It still does not do anything when I click on the link. I have included the complete code from the page. Commented Jul 21, 2013 at 17:24

1 Answer 1

4

You've a quoting error in the value of the onclick attribute:

<a href="" onclick="DisplayContactDetail("http://www.cigna.com")">

Should be for example:

<a href="" onclick="DisplayContactDetail('http://www.cigna.com')">

Also Function should be function, JS is case-sensitive.

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.