2
How do I display an Alert and clear the textbox fields in classical Sp ? I’m starting to mess with classical Asp right now, I’m lost, I just know Asp.net. I can use something from Asp.net ?
2
How do I display an Alert and clear the textbox fields in classical Sp ? I’m starting to mess with classical Asp right now, I’m lost, I just know Asp.net. I can use something from Asp.net ?
2
There is no way to display an Alert or clear controls with Asp, use javascript for this. The most you can do is insert the javascript code on the Asp page, more or less like this:
<% response.write("<script language=""javascript"">alert('Olá, fui criado com asp!');</script>") %>
To clear a textbox:
<% response.write("<script language=""javascript"">document.getElementById('meutextbox').value = ''</script>") %>
If you want to clear all the textboxes on the page, you can create a javascript function like this:
<script type="text/javascript">
function limparTextboxes() {
var textboxes = document.getElementsByTagName('input');
for (var i = 0; i < textboxes.length; i++) {
if(textboxes[i].getAttribute("type") == "text")
textboxes[i].value = "";
}
}
</script>
And call it Asp like this:
<% Response.Write("<script language=""javascript"">limparTextboxes();</script>") %>
Browser other questions tagged asp
You are not signed in. Login or sign up in order to post.