开发者

Dynamic form title

Here is my simple code:

    function save_edit(res,table_color)
开发者_开发知识库    {
        var the_form="details_"+res;
        alert(document.the_form.title.value);
    }

All I want to do is dynamically put the form from which to fetch the value of "title", but the above code is throwing a syntax error.

How do I do it?


This may be what you want

document[the_form].title.value

But I recommend you look in to getElementById and more importantly, jQuery. IN jQuery you might say:

$('form#details_' + res).find('#title').val();

To achieve the same thing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜