cmdline
06-24-2009, 06:55 AM
I have not been able to embed an anchor with an href link within the document .write code below. This is part of an image map. On the html parent page, is a small thumbnail image used as an imagemap target that when mouse clicked, first opens up a window and second using the document.write function write that window with html including the full image again including formatting and text of whatever else I might include on that window. However when I attempt to write in an anchor with an HREF link, the window never opens and instead the raw code is written out on the parent window. In other words I am trying to put an html link into the opened window and may be running into a syntax issue. The below code without an anchor runs fine:
<map id="pic101"name="pic101">
<area shape="rect" coords="1,1,250,280" onClick="pic101_win=window.open('101.jpg', 'pic101_win', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=no, scrollbars=no, top=20, left=20, width=740, height=800');
pic101_doc=pic101_win.document;
pic101_doc.write('<body bgcolor=#777777><img src=101.jpg><br><p>GR0684 </p></body>');
return false;"></map>
While the below does not per above:
<map id="pic101"name="pic101">
<area shape="rect" coords="1,1,250,280" onClick="pic101_win=window.open('101.jpg', 'pic101_win', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=no, scrollbars=no, top=20, left=20, width=740, height=800');
pic101_doc=pic101_win.document;
pic101_doc.write('<body bgcolor=#777777><img src=101.jpg><br><p>some text blah blah.</p> <a href="abc.html" target="_top" > link to another page</a> body>');
return false;"></map>
<map id="pic101"name="pic101">
<area shape="rect" coords="1,1,250,280" onClick="pic101_win=window.open('101.jpg', 'pic101_win', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=no, scrollbars=no, top=20, left=20, width=740, height=800');
pic101_doc=pic101_win.document;
pic101_doc.write('<body bgcolor=#777777><img src=101.jpg><br><p>GR0684 </p></body>');
return false;"></map>
While the below does not per above:
<map id="pic101"name="pic101">
<area shape="rect" coords="1,1,250,280" onClick="pic101_win=window.open('101.jpg', 'pic101_win', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=no, scrollbars=no, top=20, left=20, width=740, height=800');
pic101_doc=pic101_win.document;
pic101_doc.write('<body bgcolor=#777777><img src=101.jpg><br><p>some text blah blah.</p> <a href="abc.html" target="_top" > link to another page</a> body>');
return false;"></map>