Jump to content

Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

 

 

<html>

 

 

<head>

<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">

<title>Untitled Page</title>

<script type="text/javascript"><!--

var lastDiv = "";

function showDiv(divName) {

// hide last div

if (lastDiv) {

document.getElementById(lastDiv).className = "hiddenDiv";

}

//if value of the box is not nothing and an object with that name exists, then change the class

if (divName && document.getElementById(divName)) {

document.getElementById(divName).className = "visibleDiv";

lastDiv = divName;

}

}

//-->

</script>

<style type="text/css" media="screen"><!--

.hiddenDiv {

display: none;

}

.visibleDiv {

display: block;

border: 1px grey solid;

}

 

 

--></style>

</head>

 

 

<body bgcolor="#ffffff">

<form id="FormName" action="blah.php" method="get" name="FormName">

<select name="selectName" size="1" onChange="showDiv(this.value);">

<option value="one">first</option>

<option value="two" selected>second</option>

<option value="three">third</option>

</select>

            <input name="two" id="two" type="text" class="hiddenDiv">

</form>

 

</body>

 

</html>

 

 

Hi Everyone,

 

 

I am trying to load input text with onchange but when you reflesh the page it doesnt work with selected value I guess I need to use the onload same time. I dont know how to use it. Any help much appriciated.

Link to comment
https://forums.phpfreaks.com/topic/261150-using-onload-and-onchange-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.