bindu Posted September 26, 2010 Share Posted September 26, 2010 Hi, I'm unable to include javascript in child window. Pls See my Coding given below. HTML Code(File Name - Default.aspx) <form id="form1" runat="server"> <div> <input id="show" value="Main Button" type="button" onclick="SubForm()" /> </div> </form> Javascript(File Name Sub.js) function SubForm() { var generator=window.open('','name','height=400,width=500'); generator.document.writeln("<HTML>"); generator.document.writeln("<HEAD>"); generator.document.writeln("<SCRIPT language='javascript'>"); generator.document.writeln("function ShowSub()"); generator.document.writeln("{"); generator.document.writeln("var gen=window.open('','name1','height=400,width=500')"); generator.document.writeln("gen.document.writeln('<HTML>');"); generator.document.writeln("gen.document.writeln('<HEAD>');"); unable to include the following 2 line var st = "<script language='javascript' src='Sub.js'>"; generator.document.writeln("gen.document.writeln('"+st+"');"); generator.document.writeln("gen.document.writeln('</HEAD>');"); generator.document.writeln("gen.document.writeln('<BODY>');"); generator.document.writeln("gen.document.writeln('<FORM>');"); generator.document.writeln("gen.document.writeln('<DIV>');"); var stext = "<input id='show' value='2 BUTTON Page' type='button'"; generator.document.writeln('gen.document.writeln("'+stext+'");'); generator.document.writeln("gen.document.writeln('</DIV>');"); generator.document.writeln("gen.document.writeln('</FORM>');"); generator.document.writeln("gen.document.writeln('</BODY>');"); generator.document.writeln("gen.document.writeln('</HTML>');"); generator.document.writeln("}"); generator.document.writeln("</SCRIPT>"); generator.document.writeln("</HEAD>"); generator.document.writeln("<BODY>"); generator.document.writeln("<FORM>"); generator.document.writeln("<FORM>"); generator.document.writeln("</DIV>"); generator.document.writeln("<input id='show' value='1 BUTTON Page' type='button' onclick='ShowSub();'/>"); generator.document.writeln("</DIV>"); generator.document.writeln("</BODY>"); generator.document.writeln("</HTML>"); generator.document.close(); } function SubScreen1() { var gen1=window.open('','name','height=400,width=500'); gen1.document.writeln("<HTML>"); gen1.document.writeln("<HEAD>"); gen1.document.writeln("</HEAD>"); gen1.document.writeln("<BODY>"); gen1.document.writeln("<FORM>"); gen1.document.writeln("<FORM>"); gen1.document.writeln("</DIV>"); gen1.document.writeln("<input id='show' value='JBUTTON' type='button'/>"); gen1.document.writeln("</DIV>"); gen1.document.writeln("</BODY>"); gen1.document.writeln("</HTML>"); gen1.document.close(); } Quote Link to comment https://forums.phpfreaks.com/topic/214447-regarding-mulitple-window/ Share on other sites More sharing options...
Adam Posted September 26, 2010 Share Posted September 26, 2010 Most likely with the way the script tag is being written to the document it's not being parsed correctly. Why are you writing to it like this anyway, can't you just store it within a file? Quote Link to comment https://forums.phpfreaks.com/topic/214447-regarding-mulitple-window/#findComment-1115962 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.