Jump to content

do not know what the problem is


coffeecup

Recommended Posts

I do not know why this will not work. i ran it thru firefox many times the syntax is correct. i ran the document write green beans thru and that shows on the doc. could someone please let me know what is wrong with this.

thank you

<script type="text/javascript">

var paraP = document.getElementsByTagName("p");
for (var i=0; i< paraP.length; i++)
{
	var titleT = paraP[i].getAttribute("title");
	if (titleT) alert(titleT);
// if the human only writes alert (titleT) without the if (titleT) or any other logical not, alert on its own will not work
}

</script>

<script type="text/javascript">
document.write("green beans");
</script>
</head>
<body>
<h2>what to buy</h2>
<p>the brown cow</p>
<p>the barking dog</p>
<p title="a gentle reminder">Don`t forget to buy this stuff.</p>
<ul id="purchases">
	<li>a tin of beans</li>
	<li>cheese</li>
	<li>milk</li>
	</ul>

Link to comment
https://forums.phpfreaks.com/topic/235641-do-not-know-what-the-problem-is/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.