Hello,
I am trying to change a piece of text using onmouseover. I have tried a few
things so far and nothing has really worked. I get get a new piece of text
to appear but bastardizing someone elses code, but can't figure out how to
hide the other one....
I sort of have the following but don't know if this is close to the best way
of doing it really...
Basically I want to have a piece of text, lets say TEXT1, that changes from
blue to red, and to TEXT2 while the mouse is over it.
I know nothing really about Java so have had a look around but got no
futher. Any help would be great.
Cheers
<html>
<head>
<script type="text/JavaScript">
function setText(t){
if(document.lay ers)
{
with(document.l ayers["myDiv"].document)
{
open();
write(t);
close();
}
}
else if(document.all )
{
myDiv.innerHTML = t;
}
}
</script>
</head>
<body>
<a href="#"
onmouseover="se tText('test2)",
onmouseout="set Text('')">test1 </a>
<br>
<div style="position :absolute;top:1 4;left:11;width :100;" name="myDiv"
id="myDiv"></div>
</body>
</html> 5 10901
You might try this too:
<p onMouseOver="th is.style.color= '#FF0000', this.innerHTML= 'The Text
Changed' "
onMouseOut ="this.style.co lor='#000000', this.innerHTML= 'Change My
Color' "
Change My Color
</p>
"SanJoseWeb Guy" <sa***********@ aol.com.nospam> wrote in message
news:20******** *************** ****@mb-m06.aol.com... You might try this too: <p onMouseOver="th is.style.color= '#FF0000', this.innerHTML= 'The Text Changed' " onMouseOut ="this.style.co lor='#000000', this.innerHTML= 'Change
My Color' " Change My Color </p>
Thanks for the tip. Sorry, thought I can't get it to work.. What else do I
need with your snippet? I really don't know javascript at all..
Cheers
"SanJoseWeb Guy" <sa***********@ aol.com.nospam> wrote in message
news:20******** *************** ****@mb-m06.aol.com... You might try this too: <p onMouseOver="th is.style.color= '#FF0000', this.innerHTML= 'The Text Changed' " onMouseOut ="this.style.co lor='#000000', this.innerHTML= 'Change
My Color' " Change My Color </p>
Sorry to be such a pain, but that looks like it should do what I want, but
when I paste it into a n HTML document, it displays "Change My Color", but
doesn't actually do anything.
Do I need to define style or colour, or innerHTML somewhere?
Thanks
"CQMMAN" <cq****@yahoo.c o.uk> writes: "SanJoseWeb Guy" <sa***********@ aol.com.nospam> wrote in message news:20******** *************** ****@mb-m06.aol.com...
<p onMouseOver="th is.style.color= '#FF0000', this.innerHTML= 'The Text Changed' "
I would change the "," to a ";". While legal, commas are used to
separate expressions (and evaluates to the last expression) while
semicolons are used to to end statements. In the above, the value of
the second (assignment-)expression is not relevant, so it's more
appropriate to treat it as a statement.
Sorry to be such a pain, but that looks like it should do what I want, but when I paste it into a n HTML document, it displays "Change My Color", but doesn't actually do anything.
Does it give a Javascript error message? Have you turned Javascript error
messages on? (If not, do so!)
I can see your quote has line breaks all over the place. You can not
have line breaks inside Javascript strings, so try putting more of it on
one line.
It works for me if I do.
Do I need to define style or colour, or innerHTML somewhere?
No, they already exist on the element.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
"Lasse Reichstein Nielsen" <lr*@hotpop.com > wrote in message
news:wu******** **@hotpop.com.. . Does it give a Javascript error message? Have you turned Javascript error messages on? (If not, do so!)
I can see your quote has line breaks all over the place. You can not have line breaks inside Javascript strings, so try putting more of it on one line.
It works for me if I do.
Aaahhh.. Yes, linewrap.... Thanks very much for your help..
Cheers
CQMMAN This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tim |
last post by:
Hope someone in the big wide world can help...
What I want to do is have an image slideshow which automatically
scrolls through a series of images very fast, then pauses when you
move your mouse over the image. The images will flick through (at a
rate of about 5 per second) then pause when the user onMouseOver's.
Any help would be gratefully received.
:o)
|
by: Richard |
last post by:
I know I can have like <a href="#" onclick="dothis" onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat">
As an example of use:
Column A holds menu items.
When a mouse over is performed, two actions take place instead of one.
Action one sends an image to a division in column B, action two sends text
to another division in column B.
|
by: Jake |
last post by:
What would be the correct syntax for setting the z-index of a layer
OnMouseOver?
I have a mouseover action on a visible layer which displays a popup info
layer but it gets displayed behind other visible layers depending on its ID
which I beleive is inherited from its parent. I need the popup layer to
display in front of everything on the page when activated.
<DIV ID="popinfo<%=rs("ID") %>" STYLE="padding:0px; border:1px solid
#000000;...
|
by: Epetruk |
last post by:
Hi all,
I want a page where the contents of a table cell are replaced with an image
when the mouse moves over the cell, and the text is restored when the mouse
moves out. Here's the html for the page:
<HTML>
<HEAD>
<style type="text/css">
|
by: Martin Chen |
last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main
frame. The contents frame has a menu bar written with with javascript (in
the context of a table). In IE6.1 everything works fine as it also does in
firefox if I call the contents frame directly (i.e. outside of its
frameset). However, if I call my main page (index.html) which invokes the
frame set, the contents frame javascript menubar onmouseover function...
| |
by: Rob R. Ainscough |
last post by:
I'm using .NET v1.1 with ASPX web page.
I'm trying to have a RollOver hyperlink that will change images on an image
control and update the text in a Label control. I've got the image swapping
working, however I don't know how to get my Label control text to change
with the onMouseOver event
HTML...
</asp:hyperlink><asp:hyperlink id="lnkImageS" style="Z-INDEX: 113; LEFT:
|
by: den2005 |
last post by:
Hi everybody,
I am confused and still looking why this codes is not working. Can anyone notice or know why this code is not working? Thanks in advance.
Code working:
<form id="form1" runat="server">
<div>
</div>
<div>
|
by: flash |
last post by:
1-When the mouse is over the course title. Its description should appear. When it the mouse is out, the description should disappear.
2-when double click on a word, its color changes to (green) and gets larger.
===================================
<head>
<script type="text/javascript"> // i think this code need some modifying
function mover(text){
var x=document.getElementById('desplay');
x.innerHTML=text;
}
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |