www.webdeveloper.com
Results 1 to 2 of 2

Thread: passing a canvas element from a parent window to a child window

Hybrid View

  1. #1
    Join Date
    Sep 2013
    Posts
    2

    passing a canvas element from a parent window to a child window

    Hi,
    i try to ask a question but my english isnt so good. So sorry for my bad writing. I'm much better in reading and understanding. So, here are my question about some javascript problem:

    i wrote a page which generated some kind of mosaik. My javascript function get the datas, parameters and so on from the main page. But i want to open the result of the function (the generated mosaic) in a new window/tab. But now there some problems with the communication between this to pages.
    Have a look of the code:

    when the user push my button on the mainpage a function starts to generate the mosaic.
    Code:
    <a href="javascript:starteGenerierung()" id="GenerierungsButton" name="generieren"  >GENERIEREN</a>
    in the starteGenerierung() i have this to open a new window:
    Code:
     var ergebnisausgabe= window.open('Ergebnisausgabe.html','_blank');
    later on, when i want to show the retults to the user (in the new window) i draw the mosaic-canvas-element hopefully on the child page:
    Code:
    function makeMosaik (array, dx,dy,reihen,spalten, einBild){
    
    	var test1 = ergebnisausgabe.document.getElementById("fertigesMosaik");
    	var testctx =test1.getContext("2d");
    	
    	var i = 0;
    	for (var rei = 0; rei < reihen; rei++){
    		for(var spal = 0; spal <spalten; spal++){
    		
    		testctx.globalAlpha = 0.6;
    		testctx.drawImage(array[i], spal*dx, rei*dy);
    			i++;
    		}		
    	}
    }
    Is it that easy to passing variables to a child window? Or have i to do much more work on it?
    Or first, do you understanding my problem (because of worse english-skills) ?
    You will help me a lot if you can give me an answers. Thank you very much! <3

  2. #2
    Join Date
    Sep 2013
    Posts
    2
    ...yeah, i already see the first mistakes:

    communication between this two pages.
    Have a look to/in the code:
    .... oh oh oh. Im very sorry.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles