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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.