Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Saturday, August 30, 2014

How to use alert and display textbox value by javascript

How to use alert message box and display textbox value by java script:



In this post we test a JavaScript code for validating textbox. We know that JavaScript use for validation on client site. Here we take an alert message box which displays whatever is typed in textbox on web page.

Code of JavaScript:

function MsgBox (textstring)
{
alert (textstring)
}

Here textstring is the value of textbox ,we show textbox value in alert message on pege.

Example of JavaScript code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <script language="JavaScript">
function MsgBox (textstring) {
alert (textstring) }


    </script>
    <style type="text/css">
        .style1
        {
            font-sizelarge;
            text-decorationunderline;
        }
    </style>
</head>
<body>
    <form>
<div align="center">
<br />





    <strong><span class="style1">Check entered text by javascript</span></strong><br />
    <br />
    <input name="text1" type="Text" value="hello">
    <input name="submit" type="Button" value="Show Me" onclick="MsgBox(form.text1.value)">
    </form></div>
</body>
</html>
 
use alert and display textbox value by javascript
display textbox value by javascript
Other Asp.net Related post:        



No comments:

Post a Comment