Saturday, June 27, 2026

DATA TRANSFER BETWEEN ONE PAGE TO AN OTHER PAGE USING JAVA SCRIPT

 You can transfer data from one HTML page to another using JavaScript in several ways. One of the simplest methods is by using URL Query String.

Example: Transfer Data Using Query String

Page 1 (index.html)

<!DOCTYPE html>
<html>
<head>
<title>Page 1</title>
<script>
function sendData() {
var name = document.getElementById("txtName").value;
var city = document.getElementById("txtCity").value;

if (name.trim() == "" || city.trim() == "") {
alert("Please fill all fields.");
return;
}

window.location.href = "display.html?name="
+ encodeURIComponent(name)
+ "&city="
+ encodeURIComponent(city);
}
</script>
</head>
<body>

<h2>Page 1</h2>

Name:
<input type="text" id="txtName"><br><br>

City:
<input type="text" id="txtCity"><br><br>

<button onclick="sendData()">Next</button>

</body>
</html>

Page 2 (display.html)

<!DOCTYPE html>
<html>
<head>
<title>Page 2</title>
<script>
function getData() {

var params = new URLSearchParams(window.location.search);

var name = params.get("name");
var city = params.get("city");

document.getElementById("lblName").innerHTML = name;
document.getElementById("lblCity").innerHTML = city;
}
</script>
</head>

<body onload="getData()">

<h2>Received Data</h2>

Name : <span id="lblName"></span><br><br>

City : <span id="lblCity"></span>

</body>
</html>

Output

Page 1

Name : Nilesh Gupta
City : Nagpur

[ Next ]

After clicking Next, the browser URL becomes:

display.html?name=Nilesh%20Gupta&city=Nagpur

Page 2

Received Data

Name : Nilesh Gupta

City : Nagpur

Another Method: Using localStorage

Page 1

<script>
function sendData() {

localStorage.setItem("Name", document.getElementById("txtName").value);
localStorage.setItem("City", document.getElementById("txtCity").value);

window.location = "display.html";
}
</script>

Page 2

<script>
window.onload = function () {

document.getElementById("lblName").innerHTML =
localStorage.getItem("Name");

document.getElementById("lblCity").innerHTML =
localStorage.getItem("City");

}
</script>

Common Methods to Transfer Data Between Pages

MethodBest Use Case
Query String (URLSearchParams)Small, non-sensitive data
localStorageData that should persist even after page refresh
sessionStorageData only for the current browser tab/session
CookiesSmall data shared across pages or sessions
Server-side (PHP, ASP.NET, Node.js, etc.)Secure or database-backed applications

For beginners, localStorage and Query String are the easiest and most commonly used methods in JavaScript.

Java Script Test Box Blank

 <!DOCTYPE html>

<html>

<head>

    <title>Textbox Validation</title>

    <script>

        function validateTextBox() {

            var name = document.getElementById("txtName").value;


            if (name.trim() === "") {

                alert("Please enter your name.");

                return false;

            }


            alert("Submitted Successfully!");

            return true;

        }

    </script>

</head>

<body>


    <label>Name:</label>

    <input type="text" id="txtName">


    <br><br>


    <button onclick="validateTextBox()">Submit</button>


</body>

</html>

Java Script Varible Concept

 

JavaScript Variables – Simple Example with Result

A variable in JavaScript is used to store data such as numbers, text, or other values.

Syntax

var variableName = value;

or

let variableName = value;

or

const variableName = value;

Example 1: Using var

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Variable Example</title>
</head>
<body>

<h2>JavaScript Variable Example</h2>

<p id="result"></p>

<script>
var studentName = "Rahul";
var age = 21;

document.getElementById("result").innerHTML =
"Student Name: " + studentName + "<br>" +
"Age: " + age;
</script>

</body>
</html>

Output

Student Name: Rahul
Age: 21

Example 2: Adding Two Numbers

<!DOCTYPE html>
<html>
<head>
<title>Addition Example</title>
</head>
<body>

<h2>Addition of Two Numbers</h2>

<p id="demo"></p>

<script>
var num1 = 25;
var num2 = 15;
var sum = num1 + num2;

document.getElementById("demo").innerHTML =
"Number 1 = " + num1 + "<br>" +
"Number 2 = " + num2 + "<br>" +
"Sum = " + sum;
</script>

</body>
</html>

Output

Number 1 = 25
Number 2 = 15
Sum = 40

Example 3: Using let

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
let city = "Nagpur";
let state = "Maharashtra";

document.getElementById("demo").innerHTML =
"City: " + city + "<br>" +
"State: " + state;
</script>

</body>
</html>

Output

City: Nagpur
State: Maharashtra

Example 4: Using const

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
const PI = 3.14159;
const radius = 5;

let area = PI * radius * radius;

document.getElementById("demo").innerHTML =
"Radius = " + radius + "<br>" +
"Area = " + area;
</script>

</body>
</html>

Output

Radius = 5
Area = 78.53975

Difference Between var, let, and const

KeywordCan be ReassignedCan be RedeclaredScope
var✅ Yes✅ YesFunction Scope
let✅ Yes❌ NoBlock Scope
const❌ No❌ NoBlock Scope

Thursday, June 25, 2026

JAVA SCRIPT GET ELEMENT BY ID CONCEPT

 

JavaScript getElementById() with HTML Control – Simple Example with Result

What is getElementById()?

getElementById() is a JavaScript method used to access an HTML element by its id.

Syntax:

document.getElementById("elementId");
  • document → Represents the HTML document.
  • getElementById() → Finds an element using its id.
  • "elementId" → The id of the HTML element.

Example 1: Change Text

HTML + JavaScript

<!DOCTYPE html>
<html>
<head>
<title>getElementById Example</title>
</head>
<body>

<h2 id="heading">Welcome to NRsolution4u</h2>

<button onclick="changeText()">Click Here</button>

<script>
function changeText()
{
document.getElementById("heading").innerHTML = "Welcome to JavaScript!";
}
</script>

</body>
</html>

Result

Before Clicking

Welcome to NRsolution4u

[Click Here]

After Clicking

Welcome to JavaScript!

[Click Here]

Example 2: Read Value from TextBox

<!DOCTYPE html>
<html>
<head>
<title>Textbox Example</title>
</head>
<body>

Name :
<input type="text" id="txtName">

<button onclick="showName()">Show Name</button>

<p id="result"></p>

<script>
function showName()
{
var name = document.getElementById("txtName").value;

document.getElementById("result").innerHTML =
"Your Name is : " + name;
}
</script>

</body>
</html>

Result

If the user types

Nilesh Gupta

and clicks Show Name, the output will be

Your Name is : Nilesh Gupta

Example 3: Change Background Color

<!DOCTYPE html>
<html>
<head>
<title>Color Example</title>
</head>
<body>

<div id="box" style="width:200px;height:100px;background:lightgray;">
</div>

<br>

<button onclick="changeColor()">Change Color</button>

<script>
function changeColor()
{
document.getElementById("box").style.backgroundColor = "orange";
}
</script>

</body>
</html>

Result

Before

+----------------------+
| |
| Gray Box |
| |
+----------------------+

[Change Color]

After Clicking

+----------------------+
| |
| Orange Box |
| |
+----------------------+

Example 4: Enable/Disable Button

<!DOCTYPE html>
<html>
<head>
<title>Button Example</title>
</head>
<body>

<button id="btnSave">Save</button>

<button onclick="disableButton()">Disable Save Button</button>

<script>
function disableButton()
{
document.getElementById("btnSave").disabled = true;
}
</script>

</body>
</html>

Result

Before

[Save]

[Disable Save Button]

After Clicking

[Save]   (Disabled)

[Disable Save Button]

Example 5: Show Selected Option from DropDown

<!DOCTYPE html>
<html>
<head>
<title>Dropdown Example</title>
</head>
<body>

<select id="course">
<option>Java</option>
<option>Python</option>
<option>JavaScript</option>
<option>C#</option>
</select>

<button onclick="showCourse()">Show Course</button>

<p id="output"></p>

<script>
function showCourse()
{
var course = document.getElementById("course").value;

document.getElementById("output").innerHTML =
"Selected Course : " + course;
}
</script>

</body>
</html>

Result

If the selected option is

Python

After clicking Show Course

Selected Course : Python

Common Properties Used with getElementById()

PropertyDescriptionExample
innerHTMLChange HTML contentelement.innerHTML = "Hello";
valueGet or set textbox valueelement.value
style.colorChange text colorelement.style.color = "red";
style.backgroundColorChange background colorelement.style.backgroundColor = "yellow";
disabledEnable or disable controlelement.disabled = true;
srcChange image sourceelement.src = "image.jpg";

Summary

document.getElementById() allows you to access and manipulate HTML elements by their unique id. It is commonly used to:

  • Read user input from text boxes (value)
  • Change text or HTML (innerHTML)
  • Modify CSS styles (style)
  • Enable or disable controls (disabled)
  • Change images (src)
  • Work with dropdowns, buttons, checkboxes, and other HTML elements

It is one of the most fundamental and frequently used methods in JavaScript for interacting with web pages.

Sunday, June 21, 2026

Logout and direct vist to home page

  <a class="dropdown-item" 



href="../default.aspx"> using ../




            <i class="ti-power-off text-primary"></i> 

              Logout 

          </a>

DOMAIN EMAIL PROGRAMMING

USING SYSTEM.NET.MAIL 

  


 SmtpClient smtpClient = new SmtpClient("globeyog.com", 25);



        smtpClient.Credentials = new System.Net.NetworkCredential("globeyog.contact@globeyog.com", "PASSWORD");

        smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;


        MailMessage mailMessage = new MailMessage("globeyog.contact@globeyog.com", txtemail.Text);

        mailMessage.Subject = "OTP Verification - GlobeYog Yoga Demo Session Registration";


        mailMessage.Body = @"

                <html>

                <head></head>

                <body style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>


                <p>Dear Student,</p>


                <p>

                Thank you for registering for the <b>Yoga Demo Session</b> with

                <b>Globeyog</b>.

                </p>


                <p>

                To complete your registration, please verify your email address using the

                One-Time Password (OTP) below:

                </p>


                <p style='font-size:20px; color:#0066CC;'>

                <b>Your OTP: " + n.ToString() + @"</b>

                </p>


                <p>

                This OTP is valid for <b>10 minutes</b>.

                Please do not share it with anyone.

                </p>


                <p>

                If you did not request this registration, please ignore this email.

                </p>


                <p>

                Thank you for choosing <b>Globeyog</b>.

                We look forward to welcoming you to the Yoga Demo Session.

                </p>


                <br />


                <p>

                Regards,<br /><br />


                 


                <b>Team Globeyog</b><br />


                Email:

                <a href='mailto:globeyog.contact@globeyog.com'>

                globeyog.contact@globeyog.com

                </a>

                <br />


                Website:

                <a href='https://globeyog.com/demosession.aspx'>

                www.globeyog.com

                </a>


                </p>


                </body>

                </html>";





          mailMessage.IsBodyHtml = true;

           smtpClient.Send(mailMessage);




      


      


Saturday, June 20, 2026

domain email programming

 SmtpClient smtpClient = new SmtpClient("domainname", 25);


            smtpClient.Credentials = new System.Net.NetworkCredential("domainemail", "password");
            smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

            MailMessage mailMessage = new MailMessage("domainemail", tomailidcontrol);
            mailMessage.Subject = "Thanks For Registration";
            mailMessage.Body = "Dear User" + "<br>" + "Your OTP is :" + " " + Label5.Text;

            mailMessage.IsBodyHtml = true;
            smtpClient.Send(mailMessage);
            Label1.Text = "OTP Send to email please check Inbox / Spam";

DATA TRANSFER BETWEEN ONE PAGE TO AN OTHER PAGE USING JAVA SCRIPT

 You can transfer data from one HTML page to another using JavaScript in several ways. One of the simplest methods is by using URL Query Str...