admin管理员组文章数量:1302379
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','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!
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.','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!
Share edited Jul 21, 2013 at 17:38 Teemu 23.4k7 gold badges58 silver badges111 bronze badges asked Jul 21, 2013 at 17:03 Matthew CroftMatthew Croft 711 gold badge2 silver badges9 bronze badges 5- So, what's the problem? Nothing happens? Getting unexpected results? An error occurs? – Teemu Commented Jul 21, 2013 at 17:06
- Nothing happens when I click on hyperlink. – Matthew Croft 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> – Matthew Croft Commented Jul 21, 2013 at 17:23
- <table> <th colspan=2 width="auto">ALLIEDBARTON</th> <tr> <td width="50%"><a href="" onclick="DisplayContactDetail('cigna.','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> – Matthew Croft Commented Jul 21, 2013 at 17:24
- It still does not do anything when I click on the link. I have included the plete code from the page. – Matthew Croft Commented Jul 21, 2013 at 17:24
1 Answer
Reset to default 4You've a quoting error in the value of the onclick
attribute:
<a href="" onclick="DisplayContactDetail("http://www.cigna.")">
Should be for example:
<a href="" onclick="DisplayContactDetail('http://www.cigna.')">
Also Function
should be function
, JS is case-sensitive.
本文标签: Calling Javascript Function from HyperlinkStack Overflow
版权声明:本文标题:Calling Javascript Function from Hyperlink - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741704037a2393455.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论