This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Display problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Display problem" Watch "Display problem" New topic
Author

Display problem

som bhardwaj
Greenhorn

Joined: Jan 17, 2009
Posts: 2
i m using this code & trying to display "Showing List" using x.value = "Showing List"; but its not displaying. please suggest me how will it work?
<html>
<head>

<script>
function funct()
{
alert("calling");
//document.write("Listing");
var x=document.createElement('li');
x.value = "Showing List";
x.text = "Showing list"
var y = document.getElementById('A1');

try {
y.add(x, null); // standards compliant; doesn't work in IE
}
catch(ex) {
y.add(x); // IE only
}
}
</script>

</head>

<body >
<ul id= 'A1'>String<script>funct();</script>
<li>


</li>
</ul>
</body>

</html>



Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
li elements do not have text and value properties. You can set the attributes, but they are not going to do anything. If you want to add text to an li, you wither need to add a textNode or you have to use innerHTML.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display problem
 
Similar Threads
Question on how to implement multi level menu (navigation bar) in html/css
Not achieving space between div blocks containing lists
Problem with struts-menu for second level submenu
Struts Taglibs issues while including html in jsp
HTML drop downs not working