PDA

View Full Version : Control Marquee with Java Script


surferdave
08-09-2002, 08:07 PM
Hello

The follow code will change the image in "mypic" from FIRST.bmp to CHANGE.bmp on mouse over in TEST. And on mouse over in TEST2 the image in "mypic" will change to CHANGE2.bmp.
So depending on where the mouse is the image will change.

<SCRIPT LANGUAGE="JavaScript">
function a()
{
document.mypic.src="CHANGE.bmp"
}
{
document.mypic.src="CHANGE2.bmp"
}
</script>
<img name="mypic" src="FIRST.bmp">

<p onMouseOver="a()">TEST</p>
<p onMouseOver="b()">TES2</P>

I would like to create this same effect but with a Marquee. when someone put there mouse over a different <p> a Marquee for that <P> would go across the page, and display its message. Different <p> on mouse over will display different message.

Thanks for everyone's help in advance!

Dave

Mr J
08-09-2002, 11:07 PM
Something like this?

<SCRIPT>
<!--
function marq1(){
effect.innerHTML="Some Text"
}

function marq2(){
effect.innerHTML="More Text"
}

// -->
</SCRIPT>


<P onmouseover="marq1()">Some text 1</P>
<P onmouseover="marq2()">Some text 2</P>
<marquee id="effect" align=center behavior=scroll width=50% height=20>Your text</font></marquee>

take a look at:

www.huntingground.freeserve.co.uk/webplus/text/marquee.htm

surferdave
08-12-2002, 05:26 PM
Thanks MR J

that code works great, and thanks for the site, I am sure I'll learn lots more form there.

Dave