473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with my onmouseover

290 100+
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.


Expand|Select|Wrap|Line Numbers
  1. function start(){
  2. document.getElementById("theTips1").style.visibility = "hidden";
  3. document.getElementById("ticker").style.visibility = "hidden";
  4. }  // end of function
  5.  
  6.  
  7. function show_tips(targetID) { 
  8.     document.getElementById(targetID).style.visibility = "visible"; 
  9. }  // end of function
  10.  
  11. function hide_tips(targetID) { 
  12.     document.getElementById(targetID).style.visibility = "hidden"; 
  13. }  // end of function
  14.  
  15. This code is in the body
  16. <body onload="start();externalLinks();">
  17.  
and then lower down I have this:


Expand|Select|Wrap|Line Numbers
  1. <div id="theTips1"  class = "tips" style='width:400px; text-align:left; position:absolute;left:400px; top:450px;'>
  2. <b>Writing your Product Description.</b> <br>
  3. Write as much as you can - the more you write the better your advert will look. Your format will be kept;
  4.  so you can use the enter key to make seperate paragraphs to build an attractive advert.<br>
  5. <br>
  6. Your first sentences will be displayed in the listing as well as on your main advert so<br>
  7. make these first sentences interesting and inviting.
  8. <br>
  9. <br>
  10. </div>
  11.  
  12. <div class="page_name">
  13. Control Panel
  14. </div> <!-- End div: page_name --> 
  15.  
  16. <div class="pg_whole">
  17. <span class="pg_head">Add a New Product.</span>
  18. <span id="readthis" style="font-size: 8pt; font-color: red;" onmouseover="show_tips(theTips1)" onmouseout="hide_tips(theTips1)">Guidance Notes</span>
  19. </div>
  20.  
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
Jan 14 '09 #1
23 2289
Dormilich
8,658 Expert Mod 8TB
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
Jan 14 '09 #2
jeddiki
290 100+
Thanks for reply
Do you mean:

at # 1 class = "tips" should be class="tips" ?

and

#18 "show_tips(theTips1)" should be "show_tips('theTips1')" ?
Jan 15 '09 #3
Dormilich
8,658 Expert Mod 8TB
yes, that's what I meant.
Jan 15 '09 #4
jeddiki
290 100+
Thanks,
I tried it, but no change :(
Jan 15 '09 #5
Dormilich
8,658 Expert Mod 8TB
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.
Jan 15 '09 #6
jeddiki
290 100+
no CSS property "font-color"
- opps!! sorry silly typo.

"maybe the error panel can give you some hints. "
where's that error panel then ?
Jan 15 '09 #7
Dormilich
8,658 Expert Mod 8TB
@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)
Jan 15 '09 #8
jeddiki
290 100+
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 :)
Jan 15 '09 #9
Dormilich
8,658 Expert Mod 8TB
you may want to use the Firebug plugin, just awesome when it comes to debugging and coding.
Jan 15 '09 #10
jeddiki
290 100+
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:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="external.js"> 
  2. </script>
Did I leave something out ?
Jan 15 '09 #11
Dormilich
8,658 Expert Mod 8TB
is the file correctly referenced (i.e. is it in the same directory as the html file)?
Jan 15 '09 #12
jeddiki
290 100+
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
Jan 15 '09 #13
Dormilich
8,658 Expert Mod 8TB
@jeddiki
sorry, no js errors for me, Firebug confirms js loading too. although you have some CSS related errors (it's style.backgroundColor)
Jan 15 '09 #14
acoder
16,027 Expert Mod 8TB
start() is not defined because document.getElementById(theTips1) should be
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("theTips1")..
Jan 15 '09 #15
jeddiki
290 100+
Thanks,
I'll follow that up :)
Jan 15 '09 #16
jeddiki
290 100+
Hi again

I made those changes and now my extension.js file
looks like this:

Expand|Select|Wrap|Line Numbers
  1. function start() {
  2.         document.getElementById("theTips1").style.visibility = "hidden";
  3.         document.getElementById("ticker").style.visibility = "hidden";
  4. }  // end of function         
  5.  
  6. function show_tips(targetID) { 
  7.     document.getElementById("targetID").style.visibility = "visible"; 
  8. }  // end of function
  9.  
  10. function hide_tips(targetID) { 
  11.     document.getElementById("targetID").style.visibility = "hidden"; 
  12. }  // end of function
  13.  
  14. //if broswser supports addEventListener use it to set doShow to the onload event, else use attachEvent
  15.  
  16. function removeLink() {
  17. document.getElementById("mydiv").style.visibility = "hidden";
  18. }
  19.  
  20. function restoreLink() {
  21.   document.getElementById("mydiv").style.visibility = "visible";
  22. } // end function
  23.  
  24. function showName1(){
  25.         var fullName = document.main_fm.upLoad1.value;
  26.         var fileName = fullName.match(/[^\/\\]+$/);
  27.      document.main_fm.fName1.value = 'Picture file name: '+fileName;
  28. } // end function
  29.  
  30. function show_ticker() { 
  31.     document.getElementById("ticker").style.visibility = "visible"; 
  32. }  // end of function
  33.  
  34.  
  35. function chg_col() { 
  36.     document.getElementById("button1").style.background-color:#6666cc;
  37. }  // end of function
  38.  
  39. function externalLinks() { 
  40.  if (!document.getElementsByTagName) return; 
  41.  var anchors = document.getElementsByTagName("a"); 
  42.  for (var i=0; i<anchors.length; i++) { 
  43.    var anchor = anchors[i]; 
  44.    if (anchor.getAttribute("href") && 
  45.        anchor.getAttribute("rel") == "external") 
  46.      anchor.target = "_blank"; 
  47.  } 
  48. } // end of function
  49.  
  50. function checkRadio(){
  51.     var radioArr = document.getElementsByName("rad_val");
  52.     var el=document.getElementById("mydiv");
  53.     el.style.display=radioArr[0].checked?'':'none';
  54. } // end function
  55.  
  56.  
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 ?
Jan 16 '09 #17
acoder
16,027 Expert Mod 8TB
For the first problem, change the line to:
Expand|Select|Wrap|Line Numbers
  1. 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():
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(targetID).style..
Jan 16 '09 #18
jeddiki
290 100+
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 !! ????
Jan 16 '09 #19
Dormilich
8,658 Expert Mod 8TB
@jeddiki
have a look at acoder's code again. you should spot the error in the above statement.
Jan 16 '09 #20
jeddiki
290 100+
I must be going blind,
I can't see the difference !


Expand|Select|Wrap|Line Numbers
  1. function chg_col() { 
  2.     document.getElementById("button1").style.backgroundColor:#6666cc;
  3. }  // end of function
  4.  
Except that his is in italics ???
Jan 16 '09 #21
acoder
16,027 Expert Mod 8TB
How about a : (colon) in yours and an = (equals) in mine plus the value in quotes? Your syntax was invalid which I've corrected.
Jan 16 '09 #22
jeddiki
290 100+
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 :)
Jan 16 '09 #23
acoder
16,027 Expert Mod 8TB
Glad to be of assistance. Good luck with the rest of your project!
Jan 18 '09 #24

Sign in to post your reply or Sign up for a free account.

Similar topics

1
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...
5
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...
1
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...
2
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...
1
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...
5
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...
0
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...
3
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...
1
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...
2
beacon
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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
0
BarryA
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...
1
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...
0
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...
0
marktang
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,...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.