小编use*_*553的帖子

为什么每个进程有一个页表

起初我以为整个系统只有一个页面表.但是每个进程实际上有一个页表?有多个页表而不是一个页表有什么意义.

我正在实现os161的一部分

operating-system os161

10
推荐指数
2
解决办法
8623
查看次数

javascript setAttribute样式

我不知道以下两个javascript/css代码如何产生不同的结果:

第一名:

prev.setAttribute('style', 'position:absolute;left:-70px;opacity:0.4;border-radius: 150px;-webkit-border-radius: 150px;-moz-border-radius: 150px;');
Run Code Online (Sandbox Code Playgroud)

第二:

            prev.setAttribute('style', 'opacity:0.4;border-radius: 150px;-webkit-border-radius: 150px;-moz-border-radius: 150px;');
            prev.setAttribute('height', size);
            prev.setAttribute('width', size);
            prev.setAttribute('id', 'thumb'+i);
            prev.setAttribute('position', 'absolute');
            prev.setAttribute('left', '-70px');
Run Code Online (Sandbox Code Playgroud)

在第二个中,位置和左侧完全被忽略.具有2行代码而没有代码的结果是相同的.

它只适用于我放置prev.style.left,同样的位置.但是setAttribute适用于高度和宽度.我真的需要知道原因

javascript css setattribute

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

? 几何级数和的表示法

我有一个关于几何级数的问题。为什么是

1 + c + c 2 + ... + c n = ?(c n )

当 c > 1 时?我明白为什么它是 ?(n) if c = 1 并且它是 ?(1) if c < 1,但我就是不明白为什么它是 ?(c n ) if c>1。

谢谢!

runtime series big-theta

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

设置属性不起作用

我正在制作一个用于表单验证的插件作为实践,但是由于某种原因,在我创建了一个 h2 元素并尝试设置它的属性后,它不起作用。这是代码

    var testing = function(regex, value, error_msg, error_msg_field_id){
        var pattern = new RegExp(regex);
        if (!pattern.test(value)){
            var ele = document.createElement("H2");
            var node = document.createTextNode(error_msg);
            ele.setAttribute('style', 'color:white');
            alert("hi");
            jQuery(error_msg_field_id).append(node);
        }
    }
Run Code Online (Sandbox Code Playgroud)

文本显示没有问题,但不是白色的。这对我来说毫无意义

javascript jquery setattribute

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

javascript在对象方法中传递此内容

这段代码有效,但我的问题是我不明白其目的var that = this.为什么我需要像这样将它传递给setInterval.我在http://www.sitepoint.com/what-is-this-in-javascript/上读到了"this" ,但它并没有真正回答我的问题

我的JavaScript代码

function spinClass(imageSource, height, width, forward, el){

this.src = imageSource;
this.spinFoward = forward;
this.element = document.getElementById(el);
this.height = height;
this.width = width;
this.d = 0;


var img = document.createElement("img");
img.setAttribute('src', this.src);
img.setAttribute('height', this.height);
img.setAttribute('width', this.width);

this.element.appendChild(img);

this.letSpin = function letSpin(){
    //alert(this.d);
    var that = this;
    img.style.transform = "rotate(" + this.d + "deg)";
    img.style.WebkitTransform= "rotate(" + this.d + "deg)";
    img.style.MozTransform= "rotate(" + this.d + "deg)";
    img.style.msTransform= "rotate(" + this.d + "deg)";
    img.style.OTransform= …
Run Code Online (Sandbox Code Playgroud)

javascript object this

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

angularJS动态生成的li标签,使用ng repeat创建多个ul标签

以下代码包含输入框,单选按钮和按钮.

单击该按钮时,它将再生成一个输入框和单选按钮.所有单选按钮都名称相同.

  <ul id = "listOfAnswers" ng-repeat="i in addQuestion.loop(addQuestion.numOfChoice) track by $index">
    <li>
        answers:<input type="text"/>
        correct:<input type="radio" name="correctChoice" value ={{$index}}/>
    </li>
  </ul>
  <button ng-Click="addQuestion.numOfChoice = addQuestion.numOfChoice + 1">add more choices</button><br/><br/>
Run Code Online (Sandbox Code Playgroud)

当我在浏览器中打开它时,当我检查它时显示正确,它正在显示

<ul ..>
  <li> [...] </li>
</ul>

<ul .. >
  <li> [...] </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

所以每次重复生成另一个ul标签.问题是我试图通过使用获得最终的所有li项目和ajax它getElementById("ul-tag-id").children.我可以为每个li项目分配一个类名,但我更喜欢以前的方法,neater.

我在这里做错了吗?另外我只是知道有自定义指令,我不能决定什么时候应该将这些东西放在控制器中,我应该把它们放在一个指令中.我在网上找到的很多教程已经过时了,我不确定要跟哪个,有什么建议吗?

angularjs

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