dodgeitorelse3 Posted March 7, 2018 Share Posted March 7, 2018 I have been working on this code for quite some time var ul = top.document.getElementById("sub-menu"); var li = top.document.createElement("li"); var a = document.createElement('a'); var stradd = " (tours.ini not found)"; var linkText = document.createTextNode("<?php echo $loguname;?>"+stradd); a.appendChild(linkText); a.href = "tours_U/<?php echo $loguname;?>/tours.ini"; li.appendChild(a); li.setAttribute("name", "tours_download[]"); li.setAttribute("id", "li<?php echo $loguname;?>"); li.style.fontSize="12px"; ul.appendChild(li); what I am having trouble doing is setting the color of stradd variable. I cannot figure out how to access just that part to make the font color white (parenthesis included). Where can I find documentation to help me sort this out? Link to comment Share on other sites More sharing options...
dodgeitorelse3 Posted March 7, 2018 Author Share Posted March 7, 2018 my bad I meant to put this in the javascript forum, can an admin please move it? Link to comment Share on other sites More sharing options...
gizmola Posted March 7, 2018 Share Posted March 7, 2018 You can't just randomly color a piece of text. What you can do however, is put a span around that section, and style the span. Link to comment Share on other sites More sharing options...
HemendraSingh Posted March 7, 2018 Share Posted March 7, 2018 Debugging your code & find error in each line. Check your text line in debugging a.appendChild(linkText); Link to comment Share on other sites More sharing options...
dodgeitorelse3 Posted March 8, 2018 Author Share Posted March 8, 2018 thank you gizmola, no idea why I didnt think of that. @HemendraSingh, Thank you. I will have to learn how to debug javascript and then I will see what you were getting at for that line of code. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.