...

View Full Version : validating javascript onmouseover?



student101
09-11-2008, 10:52 PM
How to validate the javscript parts?
I know of the
<!-- // and end in // --> or
//<![CDATA[ and end in //]]>
Using xhtml1-transitional DOCTYPE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<a href="page.php" onmouseover="showtext('&lt;div style=&quot;padding-left:40px&quot;><a href=\'link1.php\'>Link1</a> | <a href=\'link2.php\'>Link2</a> | <a href=\'link3.php\'>Link3</a></div>','a', 'No')" onmouseout="hidetext()">Page1</a><img src="img/submenu.gif" alt=" " name="a" border="0" />
I managed to get it down to 29 Errors, 28 warning(s) , complaining about;

character "<" is the first character of a delimiter but occurred as data

Cheers

rangana
09-12-2008, 04:00 AM
Have you try on changing ' into &quot;.

- Changing < into &lt;.

- Changing > into &gt;.



<a href="page.php" onmouseover="showtext(&quot;&lt;div style=&quot;padding-left:40px&quot;&gt;&lt;a href=\&quot;link1.php\&quot;&gt;Link1&lt;/a&gt; | &lt;a href=\&quot;link2.php\&quot;&gt;Link2&lt;/a&gt; | <a href=\&quot;link3.php\&quot;&gt;Link3&lt;/a&gt;&lt;/div&gt;&quot;,&quot;a&quot;, &quot;No&quot;)" onmouseout="hidetext()">Page1</a><img src="img/submenu.gif" alt=" " name="a" border="0" />

student101
09-12-2008, 08:16 AM
I've tried that, if changed the menu.php only show the text not the menu any more.
Not sure why though; Entire menu below:

<div id="menu">
<a href="index.php" onmouseover="showtext('', '', 'No')">Home</a><img src="img/transparent.gif" alt=" " name="f" border="0" /> | <a href="aboutus.php" onmouseover="showtext('&lt;div style=&quot;padding-left:40px&quot;><a href=\'membership.php\'>Membership</a> | <a href=\'invitation.php\'>Invitation</a> | <a href=\'contactus.php\'>Contact us</a></div>','a', 'No')" onmouseout="hidetext()">About us</a><img src="img/submenu.gif" alt=" " name="a" border="0" /> | <a href="training.php" onmouseover="showtext('&lt;div style=&quot;padding-left:120px&quot;><a href=\'courses.php\'>Courses</a> | <a href=\'training_archives.php\'>Archives</a></div>', 'b', 'No')">Training</a><img src="img/submenu.gif" border="0" alt=" " name="b" /> |
<a href="events.php" onmouseover="showtext('&lt;div style=&quot;padding-left:110px&quot;><a href=\'r_central.php\'>Central</a> | <a href=\'r_eastern.php\'>Eastern</a> | <a href=\'r_southern.php\'>Southern</a> | <a href=\'events_archives.php\'>Archives</a></div>','c', 'No')" onmouseout="hidetext()">Events</a><img src="img/submenu.gif" border="0" alt=" " name="c" />
| <a href="news.php" onmouseover="showtext('&lt;div style=&quot;padding-left:150px&quot;><a href=\'articles.php\'>Articles</a> | <a href=\'publications.php\'>Publications</a> | <a href=\'news_archives.php\'>Archives</a></div>','d', 'No')" onmouseout="hidetext()">News</a><img src="img/submenu.gif" border="0" alt=" " name="d" /> |
<a href="links.php" onmouseover="showtext(' ', '', 'No')">Links</a>
</div>
You can test both, your idea below:

<div id="menu">
&lt;a href="index.php" onmouseover="showtext('', '', 'No')"&gt;Home&lt;/a&gt;<img src="img/transparent.gif" alt=" " name="f" border="0" /&gt; | &lt;a href="aboutus.php" onmouseover="showtext('&lt;div style=&quot;padding-left:40px&quot;&gt;&lt;a href=\'membership.php\'&gt;Membership&lt;/a&gt; | &lt;a href=\'invitation.php\'&gt;Invitation&lt;/a&gt; | &lt;a href=\'contactus.php\'&gt;Contact us&lt;/a&gt;</div&gt;','a', 'No')" onmouseout="hidetext()"&gt;About us&lt;/a&gt;<img src="img/submenu.gif" alt=" " name="a" border="0" /&gt; | &lt;a href="training.php" onmouseover="showtext('&lt;div style=&quot;padding-left:120px&quot;&gt;&lt;a href=\'courses.php\'&gt;Courses&lt;/a&gt; | &lt;a href=\'training_archives.php\'&gt;Archives&lt;/a&gt;</div>', 'b', 'No')"&gt;Training&lt;/a&gt;<img src="img/submenu.gif" border="0" alt=" " name="b" /&gt; |
&lt;a href="events.php" onmouseover="showtext('&lt;div style=&quot;padding-left:110px&quot;&gt;&lt;a href=\'r_central.php\'&gt;Central&lt;/a&gt; | &lt;a href=\'r_eastern.php\'&gt;Eastern&lt;/a&gt; | &lt;a href=\'r_southern.php\'&gt;Southern&lt;/a&gt; | &lt;a href=\'events_archives.php\'&gt;Archives&lt;/a&gt;</div&gt;','c', 'No')" onmouseout="hidetext()"&gt;Events&lt;/a&gt;<img src="img/submenu.gif" border="0" alt=" " name="c" /&gt;
| &lt;a href="news.php" onmouseover="showtext('&lt;div style=&quot;padding-left:150px&quot;&gt;&lt;a href=\'articles.php\'&gt;Articles&lt;/a&gt; | &lt;a href=\'publications.php\'&gt;Publications&lt;/a&gt; | &lt;a href=\'news_archives.php\'&gt;Archives&lt;/a&gt;</div&gt;','d', 'No')" onmouseout="hidetext()"&gt;News&lt;/a&gt;<img src="img/submenu.gif" border="0" alt=" " name="d" /&gt; |
&lt;a href="links.php" onmouseover="showtext(' ', '', 'No')"&gt;Links&lt;/a&gt;
</div>

I am going to throw it out there; this is the only part that does not validate, it's javascript not html; does it really matter?

Cheers

student101
10-28-2008, 09:32 AM
Chrome CSS Drop Down Menu (v2.4)
http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm
Could I not use the Chrome CSS Drop Down Menu and make it do what I need?


May have found a solution;
http://www.dynamicdrive.com/dynamicindex1/ddtabmenu.htm




Cheers

student101
04-25-2009, 07:38 AM
Please could an Admin or Moderator remove or change the links
www[dot]socsat[dot]co.za on this thread, please.

Thank you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum