Changing paragraph text with JS

I want to change the text of a paragraph depending on what is selected in <select name=“subject” onChange=“setMessage()”> The paragraph I want to change has an id of msg

and the function I have so far doesn’t do what I want:

function setMessage() {
if (subject == ‘first’) document.msg = ‘Hello mother’;

What am I missing? I’ve tried document.msg.value but that still doesn’t work.

Thanks G :slight_smile:

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



<script language="JavaScript" type="text/javascript">
var MessAry=new Array();
MessAry[1]='My Message 1';
MessAry[2]='My Message 2';
MessAry[4]='My Message 3';
MessAry[4]='My Message 4';

function CngMess(obj,id){


<select onchange="CngMess(this,'fred');" >
<option >Select</option>
<option >Mess 1</option>
<option >Mess 2</option>
<option >Mess 3</option>
<option >Mess 4</option>
<div id="fred" ></div>


Vic - many thanks. I thought I was probably being a bit simplistic. Think I need to get an updated JS primer too! Cheers G :slight_smile: