Javascript:在函数中获取对象属性

Javascript:在函数中获取对象属性,javascript,hyperlink,Javascript,Hyperlink,我创建了一个简单的javascript程序,我创建了一个名为myWin的弹出窗口,在这个弹出窗口中,我定义了两个超链接,当我点击超链接时,应该调用特定的函数,它应该打开特定的url和我从主窗口中定义的电影对象中引用的url,但不知何故,我无法从中调用函数超链接。当我点击超链接时,它会打开一个新窗口,并从电影对象中获取url。有人能帮我解决一个错误吗 代码: 实验8 var myWin=window.open(“,“myWin”,“高度=500,宽度=500,位置,菜单栏,工具栏,状态,可调整大

我创建了一个简单的javascript程序,我创建了一个名为myWin的弹出窗口,在这个弹出窗口中,我定义了两个超链接,当我点击超链接时,应该调用特定的函数,它应该打开特定的url和我从主窗口中定义的电影对象中引用的url,但不知何故,我无法从中调用函数超链接。当我点击超链接时,它会打开一个新窗口,并从电影对象中获取url。有人能帮我解决一个错误吗

代码:


实验8
var myWin=window.open(“,“myWin”,“高度=500,宽度=500,位置,菜单栏,工具栏,状态,可调整大小”);
功能电影(电影片名、网站片名、演员、网站演员)
{
这个。电影标题=电影标题;
this.the_website_title=网站_title;
这个。演员=演员;
this.the_website_actor=website_actor;
}
var myMovie=新片(“在她成为神奇女侠之前,她是亚马逊人的王妃戴安娜,被训练成一名不可战胜的战士。戴安娜在一个庇护的天堂岛上长大,她遇到了一位美国飞行员(克里斯·派恩)她向她讲述了在外部世界肆虐的大规模冲突。她确信自己能够阻止威胁,第一次离家出走。在一场结束所有战争的战争中,她与男人并肩作战,最终发现了自己的全部力量和真正命运。”,
"http://www.imdb.com/title/tt0451279/",
“Gal Gadot是以色列演员、歌手、武术家和模特。她出生在以色列Rosh Ha'ayin的一个德系犹太人家庭。她的父母是教师Irit和工程师Michael,后者是第六代以色列人。她在以色列国防军服役两年,并于2004年获得以色列小姐称号。”,
"http://www.imdb.com/name/nm2933757/?ref_=tt_cl_t1");
myWin.document.write(
+"  "
+“函数movieWin(){”
+var movieWin=window.open(\“movie.website\u title\”,\“movieWin\”,\“height=500,width=500,location,menubar,toolbar,status,resize\”)
+"      }"
+“函数actorWin(){”
+var actorWin=window.open(\“movie.actor”,“actorWin”,“height=500,width=500,location,menubar,toolbar,status,resizeable\”)
+“

” +电影演员 + "" +“

” +" } " +" " ); myWin.document.write( +" " + "" +“这部电影怎么样?” +“
”+”
“+”
” +“


” +“


” +" " );
<!DOCTYPE html>
<html>
<head>
    <style>

</style>
<title>lab 8</title>
<script type="text/javascript">

    var myWin = window.open("", "myWin", "height=500, width=500,location,menubar,toolbar,status,resizable");



    function movie(movie_title, website_title, actor, website_actor)
        {
            this.the_movie_title = movie_title;
            this.the_website_title = website_title;
            this.the_actor = actor;
            this.the_website_actor = website_actor;

        }



        var myMovie = new movie("Before she was Wonder Woman, she was Diana, princess of the Amazons, trained to be an unconquerable warrior. Raised on a sheltered island paradise, Diana meets an American pilot (Chris Pine) who tells her about the massive conflict that's raging in the outside world. Convinced that she can stop the threat, Diana leaves her home for the first time. Fighting alongside men in a war to end all wars, she finally discovers her full powers and true destiny.", 

            "http://www.imdb.com/title/tt0451279/",

            "Gal Gadot is an Israeli actress, singer, martial artist, and model. She was born in Rosh Ha'ayin, Israel, to an Ashkenazi Jewish family. Her parents are Irit, a teacher, and Michael, an engineer, who is a sixth-generation Israeli. She served in the IDF for two years, and won the Miss Israel title in 2004.", 

            "http://www.imdb.com/name/nm2933757/?ref_=tt_cl_t1");


    myWin.document.write(

        +"  <script type='text/javascript'>"

        +"      function movieWin() {"
        +"  var movieWin = window.open(\"movie.website_title\" , \"movieWin\", \"height=500, width=500,location,menubar,toolbar,status,resizable\");"
        +"      }"

        +"      function actorWin() {"
        +"  var actorWin = window.open(\"movie.actor" , "actorWin", "height=500, width=500,location,menubar,toolbar,status,resizable\");"
        +"     <p style='color: green; font-size: 17px;'>"
        + movie.actor
        + "<a href='javascript:(\""+movie.website_actor+"\");'>Click for more info</a>"
        +"      </p>"
        +"      } "
        +"  <\/script>"

        );

     myWin.document.write(
    +"  <script type='text/javascript'>"
    +   "<body style='background-image : url(lab8_images/back.png)'>"
    +   "<h1 style= 'text-align: center; color: white; font-family: monospace; font-size: 200%'> What about this movie? </h1>"
    +    '<br/>' + '<br/>' +'<br/>' 
    +  "<p style = 'font-family: monospace; font-size: 150%; color: #ffffff; text-align:center; text-decoration: none'> <a href = 'javascript:movieWin()'> CLICK HERE TO ACCESS TO THE MOVIE WINDOW </a><br></p>"
    +   "<p style = 'font-family: monospace;font-size: 150%; color: #ffffff;  text-align: center; text-decoration: none'> <a href ='javascript:actorWin();'> CLICK HERE TO ACCESS TO THE ACTOR WINDOW </a><br></p>"
+"  <\/script>"
        );

</script>

</head>
<body background = lab8_images/back.png>

</body>
</html>