Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing text on mouseover

Status
Not open for further replies.

nyx3k

Programmer
Dec 19, 2007
3
AU
I'm having a problem with some code that I typed up for a site. It works on my home computer under every browser that I have but it doesn't seem to work once I upload it.

Javascript --->

function changeText(description){
switch(description) {
case '1':
document.getElementById('describe').innerHTML = 'Travel back to the home page.';
break;
case '2':
document.getElementById('describe').innerHTML = 'Have a look at a range of websites that I have built or have had part in building.';
break;

...

default:
document.getElementById('describe').innerHTML = 'The portfolio of Ian Whitnall';
}
}

HTML --->

<div class="description_text" id="describe">
The portfolio of Ian Whitnall
</div>

<div class="nav_text"><a href="index.htm" class="nav_text" onMouseOver="changeText('1')" onMouseOut="changeText()">Home</a></div>

Can anyone see something wrong? Is there something I missed? Is case not commonly used in Javascript?
 
nyx, can you point us to your uploaded page? I'm guessing there is a conflict of interests somewhere!

Nick

where would we be without rhetorical questions...
 
The site that I am building is and the Javascript file is located The only difference I see is that the markup is a single line because it is a unix server.

Wait I think I just found something. Because it seems to be in a single line the comment at the top might be commenting out the rest of the code. You can have a look to give your own verdict anyway though.
 
Is there a way to edit posts so I don't have to double post? Well thanks for the response, but I solved the problem. I feel like a bit of a fool.

I remembered a issue similar to this where I gave my code for an application to a windows user and he complained that the code was all on one line. Thats when I found out that windows machines use two whitespace characters to end a line and return, while unix only uses a single \n.

This is simple to get around by making the windows user to use a real code editor. :D Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top