Click to See Complete Forum and Search --> : using window() instead of alert()


fip04
May 3rd, 2004, 07:31 AM
Hi,
in my HTML form, as soon as the user selects an option and clicks on the submit button, an XML file is generated inside an alert box.
a snapshot of the form code is:

<form name="form1">
<select name="sel">
<option label="1" value="D:\nrsa.jpg">US</option>
<option label="2" value="D:\pqrs.jpg">UK</option>
</form>
<input type="button" value="submit" onclick="loadfile()">

i generate the XML in the alert box using the code:

function loadfile() {
var sel_1 = document.form1.sel;
var opt_1 = sel_1.options[sel_1.selectedIndex].value;
var theStr = "<choice>\n";
theStr += "<pic> " + opt_1 + " </pic>\n";
theStr += "</choice>";
alert(theStr); }

now instead of using alert box, i wish to use the display the XML in a new window ie as soon as the submit button is clicked, a new window should open and display the XML tags.
how can i use window() in this case? i have rarely used window() in my javascripts and hence need ur help.
thanks in advance.

dynamic_sysop
May 13th, 2004, 05:24 PM
you would do it along these lines ...

<script language=javascript>
// your stuff to generate the XML file here.
doc = window.open('','','width=600,height=600');
doc.document.open();
doc.document.write('your xml data here!');
doc.document.close();
</script>