Prueba eliminar 7 caracteres (
http://) u once (
http://www.), como convenga.
Código HTML:
Ver original<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> input{width: 250px;}
<script type="text/javascript"> window.onload = function () {
var test = document.getElementById('test');
var boton = document.getElementById('boton');
boton.addEventListener('click', function (e) {
e.preventDefault();
var url = document.getElementById('url').value;
var string = url.substring(7); // eliminar http://
test.innerHTML = string;
});
};
<input type="text" id="url" value="http://www.forosdelweb.com/f13/" />