好的,我有一个包含传输名称的菜单。我想在每个标签旁边添加一个小的传输标识。这是我想要添加的代码:
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>";
答案 0 :(得分:2)
您只需使用list-style-image CSS属性即可。 http://www.w3schools.com/cssref/pr_list-style-image.asp
您可以将其添加到头部某处的文件中:
<style type="text/css">
ul { list-style-image: url('images/transmission-logo'); }
</style>
如果你想在JavaScript中做到这一点:
document.getElementById("menu").style.listStyleImage="url('images/transmission-logo')";