Web Analytics Made Easy -
StatCounter syntax error in js code - CodingForum

Announcement

Collapse
No announcement yet.

syntax error in js code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • syntax error in js code

    I have a sliced image that I am trying to make interactive with some code. when the mouse rolls over the image, the image changes slightly and a corresponding sound comes up.

    theres apparentley a syntax error on line 17

    here's this line:


    NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])?
    1:0;

    and here's the code in context.

    If you want to see the HTML code that this js code uses then just ask!

    Thanks in advance for the help!

    _ _ _ _ _ _ _ __ _ _ _ _
    <script language="JavaScript"><!-- // Sound on Mouseover javascript

    var aySound;

    new Array()=
    aySound[0]="interactive_page/guit1.wav";
    aySound[1]="interactive_page/guit2.wav";

    // Don't alter anything below this line IE
    = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)?
    1:0;

    NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])?
    1:0;

    ver4 = IE||NS? 1:0;

    window.onload=auPreload;

    function auPreload() {

    if (!ver4) return;

    if (NS) auEmb = new Layer(0,window); else { Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";

    document.body.insertAdjacentHTML("BeforeEnd",Str);
    }
    var Str = '';

    for
    (i=0;i<aySound.length;i++) Str += "<EMBED SRC='"+aySound[i]+"'

    AUTOSTART='FALSE' HIDDEN='TRUE'>" if (IE) auEmb.innerHTML = Str;

    else {
    auEmb.document.open();
    auEmb.document.write(Str);
    auEmb.document.close();
    }
    auCon = IE?
    document.all.soundfiles:auEmb;
    auCon.control = auCtrl;
    }

    function auCtrl(whSound,play) {

    if (IE) this.src = play? aySound[whSound]:'';

    else eval("this.document.embeds[whSound]."
    + (play? "play()":"stop()")) }

    function playSound(whSound) {
    if (window.auCon) auCon.control(whSound,true);
    }

    function stopSound(whSound) {
    if (window.auCon) auCon.control(whSound,false);
    } //--></script>

  • #2
    There are alot of things wrong with that script (being that it's extremely outdated), but this appears to be the source of your syntax error:
    Code:
    // Don't alter anything below this line IE
    = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)?
    1:0;
    Notice that the "IE" variable has been stuck at the end of the comment line, and the next valid expression is simply "= ( conditional ) ? val : val"

    Edit that line so that the "IE" variable is at the start of that expression, just like the statement that immediately follows it.

    Comment

    Working...
    X