Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOM - adding onMouseOver event to DOM <td>

Status
Not open for further replies.

mwolf00

Programmer
Joined
Nov 5, 2001
Messages
4,177
Location
US
How do I add mouseOver events to an element that I create using the DOM? The code in blue is not running...

newTD = document.createElement("td")
newRow.appendChild(newTD)
newInput = document.createElement("input")
newInput.setAttribute("readonly")
newInput.setAttribute("value",document.cbr.activity.value)
newInput.setAttribute("className", "act")
if (document.cbr.activity.value == ""){
popText = document.cbr.activity.value
}
else{
popText = &quot;<i>No Data Given</i>&quot;
}
newInput.setAttribute(&quot;onMouseOver&quot;, &quot;return overlib('&quot; + popText + &quot;')&quot;)
newInput.setAttribute(&quot;onMouseOut&quot;, &quot;return nd();&quot;)

newTD.appendChild(newInput)
document.cbr.activity.value = &quot;&quot;
Get the Best Answers! faq333-2924
&quot;A witty saying proves nothing.&quot; - Voltaire
mikewolf@tst-us.com
 
setEvent possibly
newInput.setEvent(&quot;onMouseOver&quot;, &quot;return overlib('&quot; + popText + &quot;')&quot;)
newInput.setEvent(&quot;onMouseOut&quot;, &quot;return nd();&quot;) _______________________________________________
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }

_______________________________________________
for the best results to your questions: FAQ333-2924

 
Thanks onpnt, but it didn't work [pc] Get the Best Answers! faq333-2924
&quot;A witty saying proves nothing.&quot; - Voltaire
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top