I am having problems getting my onmouseover to work
This is what I have in the external.js file:
The tips "theTips1" should be invisable when the page opens
but they are not. -
function start(){
-
document.getElementById("theTips1").style.visibility = "hidden";
-
document.getElementById("ticker").style.visibility = "hidden";
-
} // end of function
-
-
-
function show_tips(targetID) {
-
document.getElementById(targetID).style.visibility = "visible";
-
} // end of function
-
-
function hide_tips(targetID) {
-
document.getElementById(targetID).style.visibility = "hidden";
-
} // end of function
-
-
This code is in the body
-
<body onload="start();externalLinks();">
-
and then lower down I have this: -
<div id="theTips1" class = "tips" style='width:400px; text-align:left; position:absolute;left:400px; top:450px;'>
-
<b>Writing your Product Description.</b> <br>
-
Write as much as you can - the more you write the better your advert will look. Your format will be kept;
-
so you can use the enter key to make seperate paragraphs to build an attractive advert.<br>
-
<br>
-
Your first sentences will be displayed in the listing as well as on your main advert so<br>
-
make these first sentences interesting and inviting.
-
<br>
-
<br>
-
</div>
-
-
<div class="page_name">
-
Control Panel
-
</div> <!-- End div: page_name -->
-
-
<div class="pg_whole">
-
<span class="pg_head">Add a New Product.</span>
-
<span id="readthis" style="font-size: 8pt; font-color: red;" onmouseover="show_tips(theTips1)" onmouseout="hide_tips(theTips1)">Guidance Notes</span>
-
</div>
-
Interestingly the "Guidance Notes" does not show up in red,
so something is pretty badly wrong, but I can not see what
it is
Also the mouseover/mouseout don't do anything.
Can anyone see what I've done wrong ?
thanks
23 2289
without testing I'd say, line #1: between attribute and value there shouldn't be any whitespace characters; line #18: put the string values in quotation marks, otherwise they're not recognized as strings.
regards
Thanks for reply
Do you mean:
at # 1 class = "tips" should be class="tips" ?
and
#18 "show_tips(theTips1)" should be "show_tips('theTips1')" ?
yes, that's what I meant.
Thanks,
I tried it, but no change :(
argh.... looked once again. there is no CSS property "font-color" (you may use "color" instead). stupid I didn't see that at once.
as for the Javascript, tried it myself and it worked. maybe the error panel can give you some hints.
no CSS property "font-color"
- opps!! sorry silly typo.
"maybe the error panel can give you some hints. "
where's that error panel then ?
@jeddiki
in Firefox it's located under "Extras" or cmd+shift+j (problem is, I run the german version on a Mac, so I don't know whether the keyboard shortcut is correct or the names are as I said)
What's Firefox ?
Is it something like Internet Explorer
- a cheaper version maybe ???
ha ha ha just joking !
The error console is under the Tools tab - thanks
it does show an error :)
you may want to use the Firebug plugin, just awesome when it comes to debugging and coding.
I will look into that,
But the error says that start, show_tips, hide_tips are not defined.
Its as if it isn't picking up the external.js
Is this OK: - <script type="text/javascript" src="external.js">
-
</script>
Did I leave something out ?
is the file correctly referenced (i.e. is it in the same directory as the html file)?
It is in the same directory, so should work
Maybe you could see if you get the same js error ?
The only problem is, this is part of a members page so I can not give a simple link.
Here is the url Guru Free Stuff.
From there you will need to sign in:
member id "Fred"
pw: "pass004"
then hit the "Contorl Panel" in the menu
then click "Add a New Product"
That is the page I am taling about - you will see green tips in the middle of the page - these should be invisable and only show when mouse in over the "Guidance Notes"
If you can take a quick look, I'd much appreciate it as I can't understand why the js is not working
@jeddiki
sorry, no js errors for me, Firebug confirms js loading too. although you have some CSS related errors (it's style.backgroundColor)
start() is not defined because document.getElementById(theTips1) should be - document.getElementById("theTips1")..
Thanks,
I'll follow that up :)
Hi again
I made those changes and now my extension.js file
looks like this: -
function start() {
-
document.getElementById("theTips1").style.visibility = "hidden";
-
document.getElementById("ticker").style.visibility = "hidden";
-
} // end of function
-
-
function show_tips(targetID) {
-
document.getElementById("targetID").style.visibility = "visible";
-
} // end of function
-
-
function hide_tips(targetID) {
-
document.getElementById("targetID").style.visibility = "hidden";
-
} // end of function
-
-
//if broswser supports addEventListener use it to set doShow to the onload event, else use attachEvent
-
-
function removeLink() {
-
document.getElementById("mydiv").style.visibility = "hidden";
-
}
-
-
function restoreLink() {
-
document.getElementById("mydiv").style.visibility = "visible";
-
} // end function
-
-
function showName1(){
-
var fullName = document.main_fm.upLoad1.value;
-
var fileName = fullName.match(/[^\/\\]+$/);
-
document.main_fm.fName1.value = 'Picture file name: '+fileName;
-
} // end function
-
-
function show_ticker() {
-
document.getElementById("ticker").style.visibility = "visible";
-
} // end of function
-
-
-
function chg_col() {
-
document.getElementById("button1").style.background-color:#6666cc;
-
} // end of function
-
-
function externalLinks() {
-
if (!document.getElementsByTagName) return;
-
var anchors = document.getElementsByTagName("a");
-
for (var i=0; i<anchors.length; i++) {
-
var anchor = anchors[i];
-
if (anchor.getAttribute("href") &&
-
anchor.getAttribute("rel") == "external")
-
anchor.target = "_blank";
-
}
-
} // end of function
-
-
function checkRadio(){
-
var radioArr = document.getElementsByName("rad_val");
-
var el=document.getElementById("mydiv");
-
el.style.display=radioArr[0].checked?'':'none';
-
} // end function
-
-
When I run the page and look in the console I see two errors:
One says
Invalid Label
and points to :
function chg_col() {
document.getElementById("button1").style.backgroun d-color:#6666cc;
It doesn't like the .background-color ? why ?
And second says
Start not defined.
I can't see anything wrong with my start function:
This is where I call it:
<body onload="start(); externalLinks(); checkRadio();">
And the function is in external.js which is called with:
<script type="text/javascript" src="external.js">
</script>
Can anyone see where I've gone wrong ?
For the first problem, change the line to: - document.getElementById("button1").style.backgroundColor = "#6666cc";
JavaScript uses camel-case for the style properties and they're set to string values.
In show/hide_tips functions, use the targetID passed in, so remove the quotes around targetID when using document.getElementById(): - document.getElementById(targetID).style..
Did That
Still get same two errors
It still highlights this:
function chg_col() {
document.getElementById("button1").style.backgroun dColor:#6666cc;
as an error
The other one is start() not defined !! ????
@jeddiki
have a look at acoder's code again. you should spot the error in the above statement.
I must be going blind,
I can't see the difference ! - function chg_col() {
-
document.getElementById("button1").style.backgroundColor:#6666cc;
-
} // end of function
-
Except that his is in italics ???
How about a : (colon) in yours and an = (equals) in mine plus the value in quotes? Your syntax was invalid which I've corrected.
My apologies - I was thinking Dormilich had quoted your
post and was inadvertently comparing my post with ... my post !!
So now the showtips works I can get on with my website development !
Thanks again :)
Glad to be of assistance. Good luck with the rest of your project!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: christian9997 |
last post by:
Hi
I was trying to create a page where a SubMenu would appear when the
user moved the mouse over an item of a Menu (= Table Cell <TD>).
Unfortunately there seems to be a problem; the onMouseOver...
|
by: comshiva |
last post by:
Hi all,
I have converted my existing ASP.NET project from 1.1 to 2.0 and i have
found that everything works fine except the linkbutton control in my
datagrid which throws an javascript error when...
|
by: KShapiro |
last post by:
Hi All,
I am trying to assist my wife, by making a simple menu system for the website.
The web page is a .php4 file and does an include of the navigation file. Before it includes that file at...
|
by: nino9stars |
last post by:
Hello,
I have just started messing with absolute positioning on webpages, and
it definitely let's you do some creative things. Well, after much
searching and help, I got the images I was using...
|
by: Ciuin |
last post by:
Again I need your help.
This is the test page I am working on:
http://www.manfredkooistra.de/zeugs/test/test.php
Description:
The page shows a centered image and a navigation menue...
|
by: althafexcel |
last post by:
hi everyone
Im trying to include an external js in my aspx page under the head
tag, it doesn't load or it displays an object expected error whenver
the function from the .js is called. Actually...
|
by: Jacob Donajkowski |
last post by:
Once the user logs in I want to have the users switch from the Roster
View to the Profile View and enter their profile infomation and save
it. Then the next time they login and go to the Profile...
|
by: equazcion |
last post by:
Hi,
I have an image reference (IMG) in my page that changes depending on the value of a database field. Clicking the image triggers an Ajax call to change the database field (toggles the field...
|
by: YotamElal |
last post by:
Hello,
I have a popup problem.
When a popup is opened, I want all other popups to close immediatly.
(except for its self and it's child popups)
Here is my code:
code:
<!DOCTYPE HTML PUBLIC...
|
by: beacon |
last post by:
I'm having trouble with a personal web page that I'm designing for work. I'm not well versed in HTML and could use some assistance.
Currently, when I open the browser, the table in the head at the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |