Mary said:
I get string error when i use
I have yet to see an ECMAScript implementation throwing a StringError
exception. Probably you mean something else.
Document.Write("<script type='text/javascript' src='http://
dl.tvunetworks.com/webplayer/myTVU.js?
c=76600&w=550&h=385&autoplay=1&style=0'></script>");
What is wrong in this code?
`Document' is the identifier of a W3C DOM interface, sometimes (e.g. in the
Gecko DOM) provided as a reference to a host object that serves as holder of
the prototype object of objects implementing this interface. The former
object does not have a `Write' method. You want to access `document.write'
instead, the method of the object implementing said interface, among others.
In addition, if this code (when corrected as described above) occurs within
a HTML `script' element, you need to escape the End Tag Open (ETAGO)
delimiter, that is, `</' so that the markup parser does not find it.
Otherwise that delimiter is considered the end of the `script' element and
your script engine finds only
...."<script type='text/javascript'
src='
http://dl.tvunetworks.com/webplayer/myTVU.js?c=76600&w=550&h=385&autoplay=1&style=0'>
which is an unterminated string literal. The most simple, least error-prone
and therefore recommended way to escape `</' is to use an unregistered
ECMAScript string escape sequence for the `/': `<\/'. Because the escape
sequence `\/' is unregistered, it will be parsed as `/' by the script engine
only.
Another possibility is that you are using VBScript, in which case your
question would be off-topic.
That said, you shouldn't be using document.write() or its corresponding
methods to include `script' elements unconditionally. Just include the
`script' element:
<script type='text/javascript'
src='
http://dl.tvunetworks.com/webplayer/myTVU.js?c=76600&w=550&h=385&autoplay=1&style=0'></script>
HTH
PointedEars