URL Preview Assistance

admin

Administrator
Staff member
Greetings,

I'm new to javascript but I've written the following code that lets users preview a typed in URL in a new browser window. It works, but it needs some error checking.

Can anyone help me out with the error checking part or does anyone know where I can find a script that has error checking in it?

Here's the script I wrote:

<SCRIPT LANGUAGE="JavaScript">
<!-- // Start Preview Button
function showPage() {
var opts = 'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,resizable=yes,copyhistory=no,scrollb ars=yes';
var URL = document.form1.Address.value;
var sourcewin = window.open(URL,'Preview',opts)
}
// End Preview Button -->
</SCRIPT>

<form name="form1">
<input name="Address" type="text" id="Address" size="50" maxlength="255">
<input type="button" value=http://www.webdeveloper.com/forum/archive/index.php/"Preview" onClick="showPage()">
</form>

Thank you so much for any help you can offer!

Warm regards,
- utdream
 
Back
Top