Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

confused - creating an uordered list using document.write

hello there, newbie here.

I'm trying to create an unordered list with document.write and am having trouble.  these are the objects I'm using:

document.write(navigator.appCodeName);
document.write(navigator.appName);
document.write(navigator.appVersion);
document.write(navigator.language);
document.write(navigator.userAgent);
document.write(navigator.platform);

I've attempted to set them as individual variables using  var li1=  then setting each like li1=document.write...

Then created :

<ul>
            <li>" + li1 + "</li>
 ....and so on.

Hopefully I have explained this well enough, but my brain is a bit foggy from working on this for so long now.  I'm trying to see where I'm going wrong.  Does anyone know of or can show me an example on how to create the document.write 's as an unordered list?  Thank you very much... this is due in a few days so any promptness is greatly appreciated!! :)
0
hazydays
Asked:
hazydays
  • 3
2 Solutions
 
GreggCommented:
You need to place the value from navigator object into a variable. Then you can print that value using document.write();
var foo = navigator.appCodeName;

document.write(foo);

Open in new window


Is this homework?

Research variables first. http://www.w3schools.com/js/js_variables.asp

Then look at how document.write works: http://www.w3schools.com/jsref/met_doc_write.asp
0
 
GreggCommented:
Have a look at this example: http://jsfiddle.net/fwnje/

Click the "Run" button to execute the code. You can edit the source code directly and run your changes. Hopefully this helps you see how accomplish your goal. You can do the same with the unordered list.
0
 
hazydaysAuthor Commented:
Thank you so much!!  The jsfiddle was what really cinched it for me.  I realized I was adding document.write to the var and once I eliminated that part, it worked!!  I truly appreciate the resources!!  yes, this was homework but I only wanted some guidance which you provided beautifully.  Cheers!
0
 
GreggCommented:
Awesome. Thanks for the kind words and welcome to EE.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now