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

Saturday, August 30, 2014

Displaying the textbox value in javascript Messagebox

Displaying the textbox value in javascript Messagebox in web page:

I just wanted to get text from a textbox of web page that is entered by user and display on the same screen. This is the code we used. The text prints to the screen in alert message.

JavaScript Dialog Boxes - Alert, Prompt, Confirmation:

JavaScript has 3 important types of dialog boxes in web page. These dialog boxes are :-

JavaScript Alert Dialog Box:

<script type="text/javascript">
   alert("Warning Message");

JavaScript Confirmation Dialog Box:

<script type="text/javascript">

   var retVal = confirm("Do you want to continue ?");

   if( retVal == true )

{      alert("User wants to continue!");

                  return true;   }


      alert("User does not want to continue!");

                  return false;  }


JavaScript Prompt Dialog Box:

<script type="text/javascript">

   var retVal = prompt("Enter your name : ", "your name here");

   alert("You have entered : " +  retVal );


Print text from textbox to the same page using javaScript:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <script language="JavaScript">

function MsgBox (textstring) {
alert (textstring) }

    <style type="text/css">
            font-size: large;
<div align="center">
<br />
    <span class="style1"
        style="line-height: 115%; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: &quot;Times New Roman&quot;; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
    <strong>The text prints to the screen in alert message</strong></span><br />
    Enter text in textbox<br />
    <br />
    <input name="text1" type="Text" value="hello"><br />
    <br />
    check button and show<br />
&nbsp;<input name="submit" type="Button" value="Show Me" onclick="MsgBox(form.text1.value)"></div>

Displaying the textbox value in javascript Messagebox

Other Related Example and Tutorials:

No comments:

Post a Comment