Results 1 to 5 of 5

Thread: javascipt is wrong!!

  1. #1

    Thread Starter
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641

    Thumbs down javascipt is wrong!!

    I get a problem with this code, could someone fix it for me?

    [code
    document.write('<a class="connect" href='+sitemlinks[i]+'onmouseover='window.status='hello''; return true;" onmouseout="window.status=''; return true;>'+sitems[i]+'</a>');
    [/code]

    thanks in advance,
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  2. #2
    Lively Member Base's Avatar
    Join Date
    Aug 2001
    Location
    The Netherlands
    Posts
    65
    Think you got something wrong with you ' and " try this

    Code:
    document.write("<a class=\"connect\" href="+sitemlinks[i]+" onmouseover=\"window.status=\"hello\"\"; return true; onmouseout=\"window.status=''\"; return true;>"+sitems[i]+"</a>");
    Hope this works got counfused during the " and ' things. Watch out for escaping them!

    Good luck
    Ok

  3. #3

    Thread Starter
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641
    it brings up lots of syntax errors....
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  4. #4
    Lively Member Base's Avatar
    Join Date
    Aug 2001
    Location
    The Netherlands
    Posts
    65
    Oh.
    How's that then? Think you should really take a look at the ' and " try to escape them using \ .
    On VS6 on my system the line doesn't give any syntax error, only runtime. But that's cause I don't use your vars.

    Good luck
    Ok

  5. #5
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    You are such an idiot. Coming in here and saying that JavaScript is wrong when you give it such a crappy line,and then not bothering to try and fix it when someone points out the problem.

    This is what you submitted:
    Code:
    document.write('<a class="connect" href='+sitemlinks[i]+'onmouseover='window.status='hello''; return true;" onmouseout="window.status=''; return true;>'+sitems[i]+'</a>');
    This is what the parser sees:
    Code:
    document.write('<a class="connect" href='+sitemlinks[i]+'onmouseover='
    This is what you should submit:
    Code:
    document.write("<a class=\"connect\" href=" + sitemlinks[i] + "onmouseover=\"window.status='hello'; return true;\" onmouseout=\"window.status=''; return true;\">" + sitems[i] + "</a>");
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width