Jump to content

Js And Css On Mozilla And Ie


moin_netset
 Share

Recommended Posts

JavaScript and CSS work fine together on all modern browsers (more so in FF than IE). The probable reason why your script does not work is because you have an error.

Link to comment
Share on other sites

JavaScript and CSS work fine together on all modern browsers (more so in FF than IE). The probable reason why your script does not work is because you have an error.
you were right there was an error in the script I have rectified it but now I want do some thing more in it I am creating a menu which on mouseover uses display:block to show sub menu and some other content which have different <div> and IDI want to call some <div> to react on mouseover event to use display:block and use display:none at the sametime without increasing the script //I am using the below script in the head section<script type="text/javascript"><!--function a(par1,par2,par3){document.getElementById(par1).style.display="block"document.getElementById(par2).style.display="block"document.getElementById(par3).style.display="block"}function b(par1,par2par3){document.getElementById(par1).style.display="none"document.getElementById(par2).style.display="none"document.getElementById(par3).style.display="none"}//--></script>//using the belcw html to call the function<div onmouseover=a(id1,id2,id3) onmouseout b(id4,id5,id6)>some image</div>//the above call function is not working when I use name for the id but it works fine when I use number for the id can u explain why it is so and rectify my mistake
Link to comment
Share on other sites

What do you mean "when you use number for the id"? Anyway, your HTML and inline JS has a few syntax errors, consider what is missing:

<div onmouseover=a(id1,id2,id3) onmouseout b(id4,id5,id6)>some image</div>

Link to comment
Share on other sites

Although some browsers may vary, JavaScript normally does not allow a number to be an element ID, or even to be the first character of an ID. I realize that numbers can be helpful when creating reusable functions. For this reason, I often use a combination, like G0, G1, G2 and so on. Then I parse the id with a call to substr().

Link to comment
Share on other sites

When you call a function you can either send numbers like this:a(1, 2, 3)Or if you want to send string data you need to quote it:a("id1", "id2", "id3")
thanks a lot your comments have helped me lot,my problem is solved I was calling the function in wrong manner that's why it was not working thank you once again all of you guys
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...