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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onmouseover=" this.className????"

Status
Not open for further replies.

tzigone

MIS
Aug 11, 2003
42
TR
Hi,
i want to turn color of the table border to #d4d9e8. Therefore i define two classes in a file called search.
if i define these classes in html code it works however in a different file klike file search it does not work. Why?

<table class=&quot;jstablo&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; onmouseover=&quot;this.className='jstablo2'&quot; onmouseout=&quot;this.className='jstablo'&quot;>
 
I would love to be able to help you. I do not understand the following:

if i define these classes in html code it works however in a different file klike file search it does not work. Why?

Could you post a cut down version of your code that shows the problem so that we can help you solve it? I'm sure it's an easy one to figure out... but we would need the code to be sure.

Jeff
 
<style type=&quot;text/css&quot;>
.jstablo {
margin: 2px;
padding: 3px
}
.jstablo2 {
margin: 2px;
padding: 3px;
border: #d4d9e8
}</style>
then the code i write above comes and it works. However when i write these styles in a different file called search javascript does not work.
it is better if you tell me how i could write such a code from the beginning.:))
 
Save the following to a file named search.js:

Code:
.jstablo
{
    margin: 2px;
    padding: 3px;
}
.jstablo2
{
    margin: 2px;
    padding: 3px;
    border: #d4d9e8;
}

In your HTML file you will need to include this file. Use the following code (placed in the <head> section of your page):

[code<script type=&quot;text/javascript&quot; language=&quot;Javascript&quot; src=&quot;search.js&quot; />[/code]

Hope that fixes things.

Jeff
 
Grrr. I didn't preview... and look what happens!

That garbled line should read:

Code:
<script type=&quot;text/javascript&quot; language=&quot;Javascript&quot; src=&quot;search.js&quot; />

Jeff
 
just wondering why you put CSS code into a *.js file? couldnt you use a *.css file instead?
 

Yes - they should be in a CSS file.

tgizone - can you show us how you're linking in your external stylesheet file, please?

It should be something like:

Code:
<link rel=&quot;stylesheet&quot; href=&quot;cssfilename.css&quot; type=&quot;text/css&quot;>

Hope this helps,

Dan
 
My brain wasn't suffering from enough caffiene *sigh*. BillyRay has the right line... it's a css file (not a js file). Although... the actual name of the file is not important... the method to include it on the page is :)

I'm just off to get another cup of coffee... this won't happen again :)

Jeff
 
please excuse me if i sounded rude. i am just getting back into JS after a rather LONG time of no JS coding. and i thought maybe some things had changed dramaticaly lol.

as a side note here, since this thread relates to a question i have.

i am working on reading info on JS 1.5 (downloaded Core JavaScript Reference 1.5 & Core JavaScript Guide 1.5 from
my question is this:

is there any site that show how to use JS to manipulate CSS? i know its probably in these two things, but i havent found them yet.

i do know one should do it like this.

Code:
if(document.all){
blah
} else {
blah
}

but, i just am not sure of the syntax for both of these methods.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top