Solved

Dynamic writing graphic and text to javascript:window.open() browser

Posted on 1998-09-14
2
317 Views
Last Modified: 2008-03-17
I have a need to open a secondary browser (window.open), open a JPeG image and a separate caption.  Can this be done in a dynamic fashion without having to create an HTML file for each JPG/Caption combination?
0
Comment
Question by:bhelman
2 Comments
 
LVL 1

Accepted Solution

by:
cutetech earned 100 total points
ID: 1270843
You can try the following HTML out....

<HTML>
<BODY BGCOLOR="#ffffff" TEXT="#000000">

<SCRIPT LANGUAGE="JavaScript">
  function openGraphic(title,width,height,pic) {
    gWindow=window.open
        ("","GraphicWindow","width=" + width + ",height=" + height +           ",titlebar=yes,toolbar=yes,scrollbars=yes,location=yes,status=yes,menubar=yes")
    gWindow.document.write("<HEAD><TITLE>" + title + "</TITLE></HEAD>")
    gWindow.document.write("<CENTER><IMG SRC=\"" + pic + "\"></CENTER>")
  }
</SCRIPT>

<A HREF="#" onclick="openGraphic('Testing',400,400,'example.jpg')">OPEN</A>

</BODY>
</HTML>

You only need to change the parameters of the openGraphic(). The 1st parameter is TITLE, the 2nd parameter is WIDTH, the 3rd is HEIGHT, and the 4th is FILENAME.

CuteTech
0
 

Author Comment

by:bhelman
ID: 1270844
The problem was that I needed to include a caption under the graphic.  This solution goes 95% there.  In the second "gWindow.document.write" statement, I just needed to include a text statement at the end.

Works like a charm.

0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can't get page to reload 9 18
Validating Date 4 29
Two decimal 5 29
Difference between Nuget Package and using Bower/Node.Js/Gulp 2 14
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question