2012-06-07 5 views
0

옵션 객체 (소위)는 JavaScript 파일이 작동하도록 페이지에서 정적 매개 변수를 수집하는 데 사용됩니다. 페이지의 동적 값을 javascript 옵션 객체로 전달하는 가장 좋은 방법은 무엇입니까? 예 : 어떻게 당신이 MyAlbumID에 대한 값을 삽입해야 다음 MyAlbumID로부터 얻을 수있다ASP를 사용하여 Javascript 옵션 객체로 값을 전달하는 방법

MyOptionsObject({ 
    flashvars: { 
     xmlFilePath: "http://myurl.com/images.php?album=" + MyAlbumID 
    })​ 

: 정확히 문제가 무엇

var albumspan = document.getElementById("lblMyAlbum"); 
var albumtextnode = albumspan.firstChild; 
var MyAlbumID = albumtextnode.data; 

답변

0

?

onDynamicAction(function(){ 
    // ensure that the DOM is loaded when that action happens 

    var myAlbumID = document.getElementById("lblMyAlbum").firstChild.data; 
    // lets hope there is an element with that id and a textnode, 
    // so that this threw no error 

    MyOptionsObject ({ 
     flashvars: { 
     xmlFilePath: "http://myurl.com/images.php?album=" + myAlbumID 
     } // missing bracket, btw. 
    }); 
    // set a new object 
}) 
관련 문제