I have this part of php code...

$dom = new DomDocument();
$xp = new domxpath($dom);
$unitid = $xp->query("/ead/archdesc/dsc/c01/did/unitid");
foreach ($unitid as $check) 
	print 	'<a href="#" onClick="displayResult2(' . $check->textContent . ')">'  . $check->textContent . ' </a>'; // I presented the unitid's of a xml file and made them clickable.
	print 	 "<br/>"; 


function displayResult2(id) 

when I click an unitid, The alert message doesn't work :(
what's wrong? (i'm newbie to javascript/php/....)

When the links appear, what underlined values do you see?
Is other javascript on the page working?

they seem to be links but when i pass the mouseover then don't even underline.. so the php syntax is wrong but I don't know how to correct it..

print 	'<a href="#" onClick="displayResult2(' . $check->textContent . ')">'  . $check->textContent . ' </a>';

Yes, I have some other javascript which is working.

What is the code/text being generated?

well I found the solution
the code that works is :

echo    "<a href=\"#\" onClick=\"displayResult2('$check->textContent')\"> $check->textContent </a>";

thanks for your help anyway :) :) :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.