views:

39

answers:

1

Hi, i am trying to concat a query value into a link

wwww.test/video (query value) ".flv"

altought i think i did something wrong.

    function doSomething() {

        var test = new StringBuilderEx();
        var a = querySt("number");
        test.append("<h1>test</h1> ");
        test.append("<a ");
        test.append("href=\"http://test.com/video\"" + a + ".flv\" ");
        test.append("Style =\"display:block;width:425px;height:300px;\" ");
        test.append("id=\"player\" ");
        test.append("</a> ");
        test.append("<script language=\"JavaScript\" ");
        test.append("> ");
        test.append("flowplayer(\"player\" ");
        test.append(", \"flowplayer-3.2.2.swf\" ");
        test.append("); <\/script>");
        return test.toString()
    }

at the end all i get is a link with test.com/video and the the passed value. The StringBuilderEx is a JS script and queryST is

    function querySt(ji) {
        hu = window.location.search.substring(1);
        gy = hu.split("&");
        for (i = 0; i < gy.length; i++) {
            ft = gy[i].split("=");
            if (ft[0] == ji) {
                return ft[1];
            }
        }
    }

So it would be awesome if i get to know what am i not getting where 1 is the query number. href="http://test.com/video1.flv"

+1  A: 
    test.append("href=\"http://test.com/video\"" + a + ".flv\" ");

You have an extraneous \" there.

    test.append("href=\"http://test.com/video" + a + ".flv\" ");

Also a missing >

    test.append("id=\"player\" ");

should be

    test.append("id=\"player\">");

Also, your link has no content to click on

    test.append("</a> ");

should be

    test.append("Click me!</a> ");
Jamie Wong
Well the link intend to have no content but you are right with the / :) thank you
Jonathan