wz_jsgraphics.js and frames

A

Andrew Poulos

I'm trying to use the graphics library wz_jsgraphics.js from
http://www.walterzorn.com (I've tried emailing the author but as yet
I've not received a reply).

I've loaded the external library into the top of a frameset and then
within one of the frames I have this code:

....
<link rel="stylesheet" href="fra.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
window.onload = function() {
var jg = new top.jsGraphics("myCanvas");
jg.setColor("#ff0000");
jg.setStroke(3);
jg.drawLine(20,50,453,40);
jg.paint();
}
</script>
</head>

<body>
<div id="myCanvas" style="position:absolute; left:100px; top:100px;
width:100px; height:100px; z-index:1"></div>
....

but it keeps giving me unspecified errors. If I do this instead:

....
<link rel="stylesheet" href="fra.css" type="text/css" />
<script language="JavaScript" type="text/javascript"
src="scripts/wz_jsgraphics.js"></script>
<script language="JavaScript" type="text/javascript">
window.onload = function() {
var jg = new jsGraphics("myCanvas");
jg.setColor("#ff0000");
jg.setStroke(3);
jg.drawLine(20,50,453,40);
jg.paint();
}
</script>
</head>

<body>
<div id="myCanvas" style="position:absolute; left:100px; top:100px;
width:100px; height:100px; z-index:1"></div>
....

then it works. Is it possible, though, to get it working the first way
i.e. with the library loaded in the top of a frameset?

Andrew Poulos
 
A

Andrew Poulos

For anyone that's interested I found this snippet of information on
their web site that solved my problem:

"Can draw to different frames, or even windows generated by JavaScript.
To accomplish this, the constructor function jsGraphics() optionally
accepts a second parameter which must be a reference to the desired
frame/window."

Sorry for hassling,
Andrew Poulos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,260
Latest member
kentcasinohelpWilhemina

Latest Threads

Top