logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 09-12-2008, 10:27 AM   #1
student101
 
Join Date: Dec 2007
Posts: 379
Question validating javascript onmouseover?

How to validate the javscript parts?
I know of the
Code:
<!-- // and end in // --> or 
//<![CDATA[ and end in //]]>
Using xhtml1-transitional DOCTYPE
Quote:
<!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" />
PHP Code:
<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;
Quote:
character "<" is the first character of a delimiter but occurred as data
Cheers
__________________
Amateurs ... Built the ark.
Professionals ... Built the Titanic.
specificity [sound like spe-sifis-ity]
student101 is offline   Reply With Quote
Old 10-28-2008, 07:37 AM   #2
student101
 
Join Date: Dec 2007
Posts: 379
Question

Tried changing;
  • ' into &quot;
  • < into &lt;.
  • > into &gt;.
This does not work, the other options I have are to code / find a CSS menu equal or figure out how to validate this.

Cheers
__________________
Amateurs ... Built the ark.
Professionals ... Built the Titanic.
specificity [sound like spe-sifis-ity]
student101 is offline   Reply With Quote
Old 10-28-2008, 07:47 AM   #3
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

Quote:
Originally Posted by student101 View Post
Tried changing;
  • ' into &quot;
  • < into &lt;.
  • > into &gt;.
This does not works
Then your browser is broke. This has been supported +10 years in all browsers.
Source?
domedia is offline   Reply With Quote
Old 10-28-2008, 07:52 AM   #4
student101
 
Join Date: Dec 2007
Posts: 379
Post

How does this work? on your browser...
PHP Code:
<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" /> 
JavaScript Document;
Code:
 
//<![CDATA[
image1 = new Image
image2 = new Image
image1.src = 'img/submenu.gif'
image2.src = 'img/submenu_o.gif'
var baseopacity=0
function change(imagename, shop) {
document.a.src=image1.src
document.b.src=image1.src
document.c.src=image1.src
document.d.src=image1.src
if(shop=="Yes") {
document.e.src=image1.src
}
if (imagename == "a") {document.a.src=image2.src;
} else if (imagename == "b") {document.b.src=image2.src;
} else if (imagename == "c") {document.c.src=image2.src;
} else if (imagename == "d") {document.d.src=image2.src;
} else if (imagename == "e") {document.e.src=image2.src;
}
//document[imagename].src=image2.src
}
function showtext(thetext, imagename, shop){
if (!document.getElementById)
return
textcontainerobj=document.getElementById("menu_b")
browserdetect=textcontainerobj.filters? "ie" : typeof textcontainerobj.style.MozOpacity=="string"? "mozilla" : ""
document.getElementById("menu_b").innerHTML=thetext
change(imagename, shop)
instantset(100)
}
function notext(){
document.getElementById("menu_b").innerHTML=""
}
function hidetext(){
// instantset(baseopacity)
}
function instantset(degree){
if (browserdetect=="mozilla")
textcontainerobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
textcontainerobj.filters.alpha.opacity=degree
else if (document.getElementById && baseopacity==0)
document.getElementById("menu_b").innerHTML=""
}
//]]>
__________________
Amateurs ... Built the ark.
Professionals ... Built the Titanic.
specificity [sound like spe-sifis-ity]
student101 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:36 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com