0

Okay so I have a menu with names of transmissions. I'd like to add a small little transmission logo beside each tab. This is the code that I would like to add on to:

document.getElementById("nav02").innerHTML =
"<ul id='menu'>" +
(RIGHT HERE IS WHERE ID LIKE THE LOGO TO APPEAR, I AM NOT SURE IF THIS IS WHERE THE CODE WOULD GO EITHER)"<li><a href='32RH.html'>32RH</a></li>" +
"<li><a href='Build.html'>36RH</a></li>" +
"<li><a href='Customers.html'>42RH</a></li>" +
"<li><a href='About.html'>42RE</a></li>" +
"</ul>";

1 Answer 1

2

You just need to use the list-style-image CSS property. http://www.w3schools.com/cssref/pr_list-style-image.asp

You can add this to your file somewhere in the head:

<style type="text/css">
    ul { list-style-image: url('images/transmission-logo'); }
</style>

If you want to do it right in the JavaScript:

    document.getElementById("menu").style.listStyleImage="url('images/transmission-logo')";
Sign up to request clarification or add additional context in comments.

8 Comments

Thank you I see now, so I would use ul { list-style-image: url('images/transmission-logo'); } and put that where exactly? And how would I use that? Sorry this is my first day >.<
Whenever I add your code above the website blanks out. This is a javascript file by the way.
A style block like the one I created above should go in an HTML file. I'm assuming you have one of those because you have to link this JavaScript file from somewhere?
You do not put styles tag inside the JavaScript.
How could I do this more efficiently then if I may ask? I'm making my list in the javascript file (This is from a tutorial that I found and they were teaching how to add lists or whatever.)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.