[jQuery] newbie puzzled: create and execute script in popup
Searched the forums, but could not find solution (or did not see there
was one !)
A main page opens a popup, then I have to add DOM elements in that
popup; so far ok.
When I add script to the popup, the script is executed in main page.
(main and popup pages load jquery).
example:
main page:
$(document).ready(function(){
newForm=window.open("form_template.htm","newForm","width=400,height=500");
newForm.focus();
});
form_template.htm, contains something like:
<html>
<head>
<title>form template</title>
<script type="text/javascript" src="../js/jquery/jquery-1.2.3.js"></
script>
<script type="text/javascript" src="../js/jquery/ui/
jquery.dimensions.js"></script>
<script type="text/javascript" src="../js/jquery/ui/ui.mouse.js"></
script>
<script type="text/javascript" src="../js/jquery/ui/
ui.draggable.js"></script>
<script type="text/javascript" src="../js/jquery/ui/
ui.draggable.ext.js"></script>
<script type="text/javascript" src="../js/jquery/ui/
ui.resizable.js"></script>
</head>
<body>
</body>
</html>
When I execute (in the main page) the script:
$("body",newForm.document).append('Coucou
<script type="text/
javascript">$("Salut toi
").appendTo("body");</script>');
"Coucou" is added to popup(newForm), but "Salut toi" is added to main
page.
Think I missed something, but what ?
thanks in advance
alain