Skip to content

Instantly share code, notes, and snippets.

@carlosdelfino
Created October 18, 2010 22:04
Show Gist options
  • Save carlosdelfino/633171 to your computer and use it in GitHub Desktop.
Save carlosdelfino/633171 to your computer and use it in GitHub Desktop.
Demonstra como deve ser um script que abre novas janelas com base num dominio selecionado!
<html>
<head>
</head>
<body>
<form onsubmit="return false;">
<input id="textfield" value="www" onchange="
var basedomain = document.getElementById('basedomain').value;
var value = this.value;
var finalurl = 'http://'+value+'.'+basedomain;
alert('Tentado acessar: '+finalurl);
window.open(finalurl,'','');
" />
<select id="basedomain">
<option value="full.srv.br">full.srv.br</option>
<option value="guiabhnorte.com.br">guiabhnorte.com.br</option>
<option value="google.com">google.com</option>
<option value="gmail.com">gmail.com</option>
</select>
</form>
<script type="JavaScript">
<!--
var textfield = document.getElementById("prefix");
textfield.onLostFocus = textfield.onChange;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment