小编noW*_*ome的帖子

在document.write中嵌入<script>标记的JavaScript无法正常工作

我不确定我的代码有什么问题,但是当我尝试添加时,actorWin.document.write('<script type=\"text/javascript\"><\/script>') 一切都搞砸了.没有这一行,代码工作正常.

<!DOCTYPE html>
<meta charset="utf-8">
<title>create a window</title>

<script type='text/javascript'>
  function Movie(title, actor) {
    this.title = title;
    this.actor= actor;    
  }
</script>
</head>
<body>
<script type='text/javascript'>

  var documentary = new Movie('http://www.imdb.com/title/tt0358456/?ref_=fn_al_tt_2','http://en.wikipedia.org/wiki/Joaquin_Phoenix');
  var movieWin = new Object();
  var actorWin = new Object();  

  newWin=window.open('','Win','width=300,height=200,top=100,left=600');

   newWin.document.write(
   "<script type='text/javascript'>" +
        "function PopUpWindowMovie(url) {" +
             "movieWin=window.open(url,'','height=600,width=800,left=400,top=100,scrollbars,status,resizable');" +
             "movieWin.focus();}" + 
        "function PopUpWindowActor(){" +
             "actorWin=window.open('','','height=600,width=800,left=400,top=100,scrollbars,status,resizable');" +
             "actorWin.focus(); " +
             "actorWin.document.write('Joaquin Phoenix is a great actor and a long time vegan.<br />');" +
             "actorWin.document.write('<script type=\"text/javascript\">" + …
Run Code Online (Sandbox Code Playgroud)

javascript

5
推荐指数
1
解决办法
2万
查看次数

添加到arraylist意外的行为

我不确定这里发生了什么.任何启蒙都会受到高度赞赏.

ArrayList<Integer> al = new ArrayList<>();

for(int i = 0; i < 10; i++)
    al.add(i);

for(Integer i : al)
    System.out.println(al.get(i));

al.add(2,8); //should add the value 8 to index 2? 

System.out.println();
for(Integer i : al)
    System.out.println(al.get(i));
Run Code Online (Sandbox Code Playgroud)

产量

0
1
2
3
4
5
6
7
8
9

0
1
7
8
2
3
4
5
6
7
8
Run Code Online (Sandbox Code Playgroud)

为什么在7和8中加入...... 9在哪里?

java arraylist

3
推荐指数
1
解决办法
96
查看次数

为什么我的隐藏和显示的基本CSS代码不起作用?

我使用谷歌浏览器,我希望当我将鼠标悬停在它上面时,背景的配置文件消失.但是唉它没有......我确定我做的事情从根本上说是错误的.请解释

HTML

<body>
<div id ="pictures">
profile
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

#pictures {
    height: 100px;
    width: 200px;
    display: block;
    background-color:#FCC;
}
#pictures:hover {
    display: none;
}
Run Code Online (Sandbox Code Playgroud)

css

0
推荐指数
1
解决办法
46
查看次数

基本.click功能我无法开始工作jQuery

有谁知道我可能做错了什么?为什么这个基本的点击功能没有被执行到发送警报的程度.我有jQuery-1.7.1.js链接到我的页面.

jQuery的

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


<script type="text/javascript" src="../fruith/jquery-1.7.1.js"></script>

<script type="text/javascript">
function checkedDark () {

$('#activate_post_checkbox').click(function(){
    alert('duh')

  $('#work').css('color', this.checked ? '#000' : '#666');

});


}
</script>

</head>
Run Code Online (Sandbox Code Playgroud)

HTML

<body>
<div id="work">blah blah blah</div>


<input type="checkbox" id="activate_post_checkbox" value="active"  /><span id="activate_post_checkbox_text">Make my posting active immediately.</span>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

jquery

0
推荐指数
1
解决办法
56
查看次数

标签 统计

arraylist ×1

css ×1

java ×1

javascript ×1

jquery ×1