Xoom
06-09-2003, 05:22 AM
I think this might be a silly question but I'm really stuck.
I want to change a variable with javascript on a mouseOver-script. This is what I've done:
First I made a script at the beginning of the page, stating the variables and arrays:
<script language="JavaScript">
<!--
var showNum = 2;
var tom = new Array('')
var ingemar = new Array('<span class="ingress">Namn:</span> Ingemar Någonting<br><span class="ingress">Uppgifter:</span> Översättning<br>');
var infoText = new Array(tom,ingemar);
-->
</script>
Further down on the page I'm writing out the Array, depending on the variable showNum, in a <TD>:
<td ID="textTD" class="brodtext" valign="top" width="529">
<script language="javascript">
document.write(infoText[showNum])
</script>
</td>
To that point everything is working out just fine! But what I want to do next is to change which text-Array-content that will show, using a mouseOver-script on a image.
(this is how I've tried; onMouseOver=parent.infoText.value=4)
Is this possible? Can I change that text-Array to show another content without refreshing the page?
I would be deeply thankfull to anyone who can help me!
/Xoom
I want to change a variable with javascript on a mouseOver-script. This is what I've done:
First I made a script at the beginning of the page, stating the variables and arrays:
<script language="JavaScript">
<!--
var showNum = 2;
var tom = new Array('')
var ingemar = new Array('<span class="ingress">Namn:</span> Ingemar Någonting<br><span class="ingress">Uppgifter:</span> Översättning<br>');
var infoText = new Array(tom,ingemar);
-->
</script>
Further down on the page I'm writing out the Array, depending on the variable showNum, in a <TD>:
<td ID="textTD" class="brodtext" valign="top" width="529">
<script language="javascript">
document.write(infoText[showNum])
</script>
</td>
To that point everything is working out just fine! But what I want to do next is to change which text-Array-content that will show, using a mouseOver-script on a image.
(this is how I've tried; onMouseOver=parent.infoText.value=4)
Is this possible? Can I change that text-Array to show another content without refreshing the page?
I would be deeply thankfull to anyone who can help me!
/Xoom