Reputation:
I am stuck with a silly issue. Please help. I want to display an info icon which, on click, should open a pdf. The icon does not get displayed although it exists in the server. However, when I'm pasting the same code on the console, it gets displayed. Following is the code-
<script type="text/javascript">
function open_win(){
window.open("../resources/Devices_overview_explained_v1_final.png","_blank",
"toolbar=no, location=no, directories=no, status=no, menubar=no,
scrollbars=yes, resizable=no, copyhistory=yes, width=805, height=700");
}
</script>
<div id="sysOverview" style="width: 855px; margin-top: 40px;">
<div class="title" style="margin: 10px 0px 10px 0px;" align="center">
Analyzed Devices Overview [<%
Calendar now = Calendar.getInstance();
int year = now.get(Calendar.YEAR);
out.println((year - 2) + " - " + year + "]");
%>
<input type="image" src="../resources/images/Infoicon_Intel.png"
class="tooltip_info_img" alt="" onclick="open_win()">
</div>
</div>
Screenshot showing the code works when pasted on console
Upvotes: 0
Views: 52
Reputation: 474
If you remove the line breaks in window.open you won't get an error.
<script type="text/javascript">
function open_win(){
window.open("../resources/Devices_overview_explained_v1_final.png","_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=805, height=700");
}
</script>
<div id="sysOverview" style="width: 855px; margin-top: 40px;">
<div class="title" style="margin: 10px 0px 10px 0px;" align="center">
Analyzed Devices Overview [<%
Calendar now = Calendar.getInstance();
int year = now.get(Calendar.YEAR);
out.println((year - 2) + " - " + year + "]");
%>
<input type="image" src="../resources/images/Infoicon_Intel.png"
class="tooltip_info_img" alt="" onclick="open_win()">
</div>
</div>
Upvotes: 1