homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Javascript debug (probably easy)
changing the contents of a <div> but that's not the hard part...

10+ Year Member

Msg#: 65 posted 8:10 am on Mar 11, 2002 (gmt 0)

dhdepot.htm (on the site in my profile) is the page in question

okay, the script is as follows:
//set up quote for now

var quotetouse="quote" ;
document.all.qlayer.innerHTML=quotetouse ;
var cat=99 ;

//end set up quote

//this func is called when user mouses over an image, as follows: onMouseOver="swapoutquote(1);"

function swapoutquote(cat) {
if (cat=1) {
desc="Category1desc"; }
if (cat=2) {
desc="Category2desc"; }
if (cat=3) {
desc="Category3desc"; }
if (cat=4) {
desc="Category4desc"; }
if (cat=5) {
desc="Category5desc"; }
if (cat=6) {
desc="Category6desc"; }
if (cat=7) {
desc="Category7desc"; }
if (cat=8) {
desc="Category8desc"; }
if (cat=9) {
desc="Category9desc"; }
if (cat=0) {
desc="Category0desc"; }
if (cat=99) {
desc="!!<br>Error!"; }


function swapinquote() {

what it does is say "Error!" indicating that cat still equals 99? or is it just assigning desc to the last one? Cos before i added the '99' error checking it was setting desc to "Category0desc".

if you go to the link, the nav in question is the pic at left, but i only put the onMouseOver's on the top 2 slices so far.

thx for any help!

(edited by: tedster at 9:02 am (utc) on Mar. 11, 2002)



WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 65 posted 9:29 am on Mar 11, 2002 (gmt 0)

Welcome to Webmaster World, dan2k

Looks to me like you need to edit the onMouseover function calls -- right now you still have some Dreamweaver code:


should probably be:

Also, be warned that there are several recent browsers that don't support onMouseover for image tags - better to put all your onMouseover calls in the anchor tag for cross-browser support.


WebmasterWorld Senior Member 10+ Year Member

Msg#: 65 posted 8:58 am on Mar 14, 2002 (gmt 0)

Another consideration when it comes to cross browser support is the innerHTML property.

It's actually doesn't exist. It's something that IE threw into the language and that later versions of Netscape picked up because of popular demand.

There are other ways of doing it, both for image mouseovers and for more in depth dynamic content.

The other benefit of using alternate methods is that they involve both the default text/code and the text/code that replaces it actually existing on the page (as far as a robot is concerned). Good for search engine indexing.


10+ Year Member

Msg#: 65 posted 7:06 am on Mar 15, 2002 (gmt 0)

Did you spot it?

Every "if" condition is true except for this one: if (cat=0)

You're using the assignment operator "=". You should be using the comparison operator "==".


10+ Year Member

Msg#: 65 posted 5:56 am on Mar 16, 2002 (gmt 0)

Thank you, Mike. I didn't notice that. It's been awhile since I borrowed that JavaScript book.



Also, does anyone care to enlighten me as to the following:
(A) What Netscape compatibility can I expect for the innerHTML? As long as v6 is supported, it's good enough for the moment.
(B) What is a good way to do something like this which would be very cross-browser?

Thanks for your help,


10+ Year Member

Msg#: 65 posted 6:56 am on Mar 16, 2002 (gmt 0)

After fixing that page and checking it out in Netscape, I see that it doesn't even work in Netscape 6.2.

Since the client I'm working on this for is a big Netscape fan, it should be changed, even though that particular effect is only secondary in nature. We're going to put the name of each category on the "over" version of each slice.


WebmasterWorld Senior Member 10+ Year Member

Msg#: 65 posted 8:24 am on Mar 18, 2002 (gmt 0)

StickyMailed you other method.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved