www.webdeveloper.com
Results 1 to 2 of 2

Thread: Help with new Window

  1. #1
    Join Date
    Apr 2010
    Posts
    2

    Help with new Window

    I am trying to come up with the right function that when a user fills out the form and clicks "Create Resume" a new window will open with the results of the input from the user.. I can not create another document... the function that I started creating is in red.. any thoughts?


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <head>
    <title> WEB 115 Final Project</title>

    <script>
    function myResume()
    {
    resumeWindow = window.open()
    resumeWindow.document.write()
    }
    </script>

    </head>
    <body>
    <script type="text/javascript" src="projectJS.js">
    </script>


    <hr width=60%>
    <center>Build Your Resume</center>
    <form action="" method="get" enctype="application/x-www-form-urlencoded">
    <table>
    <tfoot>
    <tr>
    <td colspan="2"><input type="button" value="Create Resume" onclick="myResume()"/></td>
    </tr>
    </tfoot>
    <tr>
    <th>Full Name:</th>
    <td><input type="text" name="name" size="50" /></td>
    </tr>
    <tr>
    <th>Address:</th>
    <td><input type="text" name="address" size="100" /></td>
    </tr>
    <tr>
    <th>Number:</th>
    <td><input type="text" name="number" size="50" /></td>
    </tr>
    <tr>
    <th>Email Address:</th>
    <td><input type="text" name="email" size="50" /></td>
    </tr>
    <tr>
    <th>Personal Information:</th>
    <td><textarea name="personal" rows="4" cols="60"></textarea></td>
    </tr>
    <tr>
    <th>Career Objectives:</th>
    <td><textarea name="objectives" rows="4" cols="60"></textarea></td>
    </tr>
    <tr>
    <th>Educational Background:</th>
    <td><textarea name ="background" rows="4" cols="60"></textarea></td>
    </tr>
    <tr>
    <th>Latest Dates of Employment:</th>
    <td><input type="text" name="name" size="50" /></td>
    </tr>
    <tr>
    <th>Latest Employment:</th>
    <td><textarea name="recentexperience" rows="4" cols="60"></textarea></td>
    </tr>
    <tr>
    <th>Prior Employment #1:</th>
    <td><textarea name="priorone" rows="4" cols="60"></textarea></td>
    </tr>
    <tr>
    <th>Prior Employment #2:</th>
    <td><textarea name="priortwo" rows="4" cols="60"></textarea></td>
    </tr>
    <tr>
    <th>Prior Employment #3:</th>
    <td><textarea name="priorthree" rows="4" cols="60"></textarea></td>
    </tr>
    <tr>
    <th>References:</th>
    <td><textarea name="references" rows="4" cols="60"></textarea></td>
    </tr>
    </table>
    </form>

    </body>
    </html>

  2. #2
    Join Date
    Oct 2006
    Posts
    939
    My thoughts were to include a cookie script so that the user could close and walk away to think about the meaning of life, then return and have the cookie populate all the elements so they could pick up where they left off. But since I gave you a window.open and document.write method yesterday, I'm sure I have no idea what you hope to do.
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <head>
    <title> WEB 115 Final Project</title>
    <STYLE type=text/CSS>
    .w1{font-weight:normal;font-family:comic sans ms; color:#112233;font-size:12px}
    
    </STYLE>
    <script type="text/javascript" >
    var fct=['1Full Name:','1Address:','1Number:','1Email Address:','2Personal Information:','2Career Objectives:','2Educational Background:','1Latest Dates of Employment:','2Latest Employment:','2Prior Employment #1:','2Prior Employment #2:','2Prior Employment #3:','2References:']
    function myResume(){
    	var fe=document.forms[0].elements;
    	var d=document.getElementsByTagName('div')[0];
    var w='<table style="font-family:Edwardian Script ITC;font-size:40px;color:#116677" border=0>';
    	for(i=0;i<fct.length;i++){w+='<TR><TD class="w1">'+fct[i].substring(1,fct[i].length)+'</TD><TD>'+fe[i].value+'</TD></TR>'}
    	d.innerHTML=w
    }
    </script>
    </head>
    <body>
    <DIV>
    
    <hr width=60%>
    <center>Build Your Resume</center>
    <form action="" method="get" enctype="application/x-www-form-urlencoded">
    <table border=1 style="border-collapse:collapse">
    
    <script type="text/javascript">
    
    var typ=[]; typ1='<input size="100%"  />'; typ2='<textarea rows="4" cols="60"></textarea>'
    var t=""
    for(i=0;i<fct.length;i++){	intype=fct[i].substring(0,1)==1?typ1:typ2;
    	t+='<tr><td style="font-weight:bold;text-align:center">'+fct[i].substring(1,fct[i].length)+'</td><td>'+intype+ '</td></tr>'}
    t+='<tfoot><tr><td colspan="2"><input type="button" value="Create Resume" onclick="myResume()"/></td></tr></tfoot>'
    document.write(t+'</table>')
    </script> 
    </form>
    
    </DIV>
    </body>
    </html>

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