I want some information about a browser, to be inserted automatically into a text box when a page loads. However quite how to do this im not sure.

I have made the form and have a JavaScript which does the job, but I want to know how to get the JavaScript to display the information in the text field.

Here is the JavaScript:

<!-- Begin
var xy = navigator.appVersion;
xz = xy.substring(0,4);
document.write("<center><table border=1 cellpadding=0><tr><td>");
document.write("<center><b>", navigator.appName,"</b>");
document.write("</td></tr><tr><td>");
document.write("<center><table border=0 cellpadding=0><tr>");
document.write("<td>Code Name: </td><td><center>");
document.write("<b>", navigator.appCodeName,"</td></tr>");
document.write("<tr><td>Version: </td><td><center>");
document.write("<b>",xz,"</td></tr>");
document.write("<tr><td>Java enabled: </td><td><center><b>");
if (navigator.javaEnabled()) document.write("sure is!</td></tr>");
else document.write("<font color=red>**NO**</font></td></tr>")
document.write("<tr><td>Screen Resolution too high: </td><td><center>");
document.write("<b><font color=red>",screen.width," x ",screen.height,"</font></td></tr>");
document.write("</table></tr></td></table></center>");
// End -->

And heres the basic form:

<form method="POST" action="--WEBBOT-SELF--" onSubmit="location.href='_derived/nortbots.htm';return false;" webbot-onSubmit>
<!--webbot bot="SaveResults" u-file="_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan i-checksum="43374" --><p>
<textarea rows="5" name="S1" cols="33">I WANT THE SCRIPT TO BE DISPLAYED HERE onLoad</textarea></p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

I've tried a few things with no success. I think the script may need changing to make this work. Anyone got any ideas?

Cheers,

NuGG

Here is an example if it helps.CLICK HERE! Note that your screen resolution must be above 1024X768 to view the example, otherwise it will just forward you to another page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.