redarrow Posted September 29, 2006 Share Posted September 29, 2006 is there anyway i can use css to stop the code from being seen via the valadation on w3ci have got the following in a texarea to show users the code but when i valadate the page i get errors becouse the code is already within the page so what do i do.is it possable to show code within a teaxtarea and stop the code getting valadated maybe a css will do it.[code]---start code----1.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"2."http://www.w3.org/TR/html4/strict.dtd"> 3.<html>4.<head>5.<title>Hi ya</title>6.<link rel="stylesheet" type="text/css" href="example2.css>7.</head>8.<body>9.<p class="test">hi there i am <br>reddarrow</p>10.</body>11.</html>-----end code-------[/code] Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 29, 2006 Share Posted September 29, 2006 Are you typing plain html inot the textarea? If you are then this why. You should chnage the html characters into there html equivalents. EG:< converts to & lt;> converts to & gt;& converts $ amp;Note the examples above should not have a space before the & character. I had do this due to the forum pasing the html.if you are adding the html in with php then use the htmlspecialchars function:[code=php:0]$myhtmlvar = htmlspecialchars($myhtml);echo '<textarea ..your html attributes here ...>' . $myhtmlvar . '</textarea>';[/code]This will then prevent the validator from flagging errors. Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2006 Author Share Posted September 29, 2006 heres my code within the text area how do i do it dont get it sorry.[code]<div class="info">Example 2</div><div class="info_box_two"><textarea class="info_box_two" >---start code----1.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"2."http://www.w3.org/TR/html4/strict.dtd"> 3.<html>4.<head>5.<title>Hi ya</title>6.<link rel="stylesheet" type="text/css" href="example2.css>7.</head>8.<body>9.<p class="test">hi there i am <br>reddarrow</p>10.</body>11.</html>-----end code-------</textarea></div>[/code] Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2006 Author Share Posted September 29, 2006 is this correct dosent work?[code]<div class="info">Example 2</div><div class="info_box_two"><textarea class="info_box_two" >---start code----1.>!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"2."http://www.w3.org/TR/html4/strict.dtd"< 3.>html<4.>head<5.>title>Hi ya</title<6.>link rel="stylesheet" type="text/css" href="example2.css<7.>/head<8.>body<9.>p class="test"<hi there i am <br>reddarrow>/p<10.>/body<11.>/html<-----end code-------</textarea></div>y><p class="test">hi there i am <br>reddarrow</p></body><html>[/code] Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 29, 2006 Share Posted September 29, 2006 Like this:[code]<!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=iso-8859-1" /><title>example.html</title></head><body>Hees my code:<br /><textarea cols="50" rows="15"><!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><title>example.html</title></head><body>Hees my code:<textarea name="html"></textarea></body></html></textarea></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2006 Author Share Posted September 29, 2006 solvedThank you so much never used them before ever more study dam![code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <html><head><title>john</title><link rel="stylesheet" type="text/css" href="css.css"></head><body><p><TEXTAREA rows="10" cols="10" class="info_box">---start code----1.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">2.<"http://www.w3.org/TR/html4/strict.dtd"> 3.<html>4.<head>5.<title> Hi ya </title>6.<link rel="stylesheet" type="text/css" href="example2.css">7.</head>8.<body>9.< class="test">hi there i am br reddarrow p>10.</body>11.</html>-----end code-------</textarea></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.