HighDots Forums  

Javascript still not validating with CDATA tags??

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Javascript still not validating with CDATA tags?? in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mlmoore
 
Posts: n/a

Default Javascript still not validating with CDATA tags?? - 03-26-2009 , 02:03 PM






Hi,

Please see the below code example. Dreamweaver validation is showing "< found
between tags" for this script necessary for doing Yahoo advertising. I've tried
the CDATA tags different ways including: "<![CDATA[" and "]]>" and this doesn't
work either. Please see attached code for reference. I appreciate your
feedback.
Thanks,
Michelle



<script language="JavaScript" type="text/javascript">
//<![CDATA[
<!-- Yahoo! Inc.
window.ysm_customData = new Object();
window.ysm_customData.conversion = "transId=,currency=,amount=";
var ysm_accountid = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
document.write("<SCR" + "IPT language='JavaScript' type='text/javascript' "
+ "SRC=//" + "srv2.wa.marketingsolutions.yahoo.com" + "/script/ScriptServlet"
+ "?aid=" + ysm_accountid
+ "></SCR" + "IPT>");
// -->
//]]>
</script>


Reply With Quote
  #2  
Old   
Michael Fesser
 
Posts: n/a

Default Re: Javascript still not validating with CDATA tags?? - 03-26-2009 , 02:44 PM






..oO(mlmoore)

Quote:
Please see the below code example. Dreamweaver validation is showing "< found
between tags" for this script necessary for doing Yahoo advertising. I've tried
the CDATA tags different ways including: "<![CDATA[" and "]]>" and this doesn't
work either. Please see attached code for reference. I appreciate your
feedback.
Thanks,
Michelle



script language="JavaScript" type="text/javascript"
//<![CDATA[
!-- Yahoo! Inc.
window.ysm_customData = new Object();
window.ysm_customData.conversion = "transId=,currency=,amount=";
var ysm_accountid = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
document.write("<SCR" + "IPT language='JavaScript' type='text/javascript' "
+ "SRC=//" + "srv2.wa.marketingsolutions.yahoo.com" + "/script/ScriptServlet"
+ "?aid=" + ysm_accountid
+ "></SCR" + "IPT>");
// --
//]]
/script
Ugly. Really ugly. I'm wondering what all these string concatenations
are for ... Anyway, why not simply put a _clean_ version of that script
into an external file? If you don't want that, try this:

<script type="text/javascript">
window.ysm_customData = new Object();
window.ysm_customData.conversion = "transId=,currency=,amount=";
var ysm_accountid = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
document.write("<script type='text/javascript' "
+ "src=//srv2.wa.marketingsolutions.yahoo.com/script/ScriptServlet"
+ "?aid=" + ysm_accountid + "><\/script>");
</script>

Besides some cleanup the only real difference is that I changed the
closing 'script' tag in the code to <\/script>. Notice the backslash.
This code perfectly validates as HTML.

Micha


Reply With Quote
  #3  
Old   
mlmoore
 
Posts: n/a

Default Re: Javascript still not validating with CDATA tags?? - 03-26-2009 , 04:33 PM



Hi Michael,
Thanks for your help. I'm new to javascript. I think I should have mentioned
it's xhtml too - sorry if that changes your reply. However, I'm wondering,
this script is generated from Yahoo for their advertising campaigns - this code
is used to track conversions(sales) that come from various adgroups. Do you
know if the changes you made effect how the cod works (or if it will work).
Not knowing javascript, I'm not sure if that really changes anything on Yahoo's
end as far as recognizing it for it's function.

Thanks - and I guess I"ll need to look into making an external file? This
code in particular needs to be between the <head></head> tags, so I'm guessing
that wouldn't work.

Thanks so much again - I appreciate your help!
Michelle


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

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.