小编kaw*_*ade的帖子

鼠标悬停的元素ID

我正在使用JavaScript来获取鼠标悬停时元素的id.但我没有得到它.根据我的代码,它显示为null.

我的代码是:

function getid() {
  var e = document.getElementById(this);
  alert(e);
}
Run Code Online (Sandbox Code Playgroud)

我正在调用函数:

<input 
  style="margin: 8px 4px 4px 4px; width:142px; height:117px;"
  type="image" 
  id="img" 
  src="images2.jpg" 
  onmouseover="getid();" 
  onmouseout="outmouse();" 
/> 
Run Code Online (Sandbox Code Playgroud)

如何在鼠标悬停时获取元素id?

html javascript

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

c#中非静态字段的对象引用

我在c#中创建了一个函数:

public void input_fields(int init_xcor, int init_ycor, char init_pos, string input)
{
    char curr_position = 'n';           
    foreach (char c in input)
    {           
        if (c == 'm')
        {
            Move mv = new Move();
            if (curr_position == 'e' || curr_position == 'w')
            {
                init_xcor = mv.Move_Step(curr_position, init_xcor, init_ycor);
            }
            else
            {
                init_ycor = mv.Move_Step(curr_position, init_xcor, init_ycor);
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我把这个函数称为:

input_fields(init_xcor, init_ycor, init_pos, input);
Run Code Online (Sandbox Code Playgroud)

但是在调用它时会出错:

非静态字段,方法或属性'TestProject.Program.input_fields(int,int,char,string)'xxx\TestProject\Program.cs需要对象引用23 17 TestProject

我不想让函数静态,因为我还要进行单元测试..

我该怎么办?...请帮帮我.

c# reference object

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

要求没有以角度定义

我正在使用angularjs,我创建了一个js文件(loginCtrl.js),我已经包含了一个控制器.我已经在另一个文件(server.js)中定义了我的数据库连接和模式,我想在我的js中包含该文件.

我的loginCtrl.js看起来像:

test.controller('loginCtrl', function($scope, loginService){

   $scope.login = function(user)
   {
       console.log('inside function 1');
       var user = require('./server.js')
      console.log('inside function');
       loginService.login(user);
   }

});
Run Code Online (Sandbox Code Playgroud)

和我的server.js文件看起来像:

var express = require('express');
var mongoose = require('mongoose');

mongoose.connect('mongodb://localhost/userregistration');

var userSchema = {
    username: String,
    firstname:String,
    lastname: String,
    email: String,
    password: String
}

var User = mongoose.model('User', userSchema, 'user');
Run Code Online (Sandbox Code Playgroud)

当我运行代码时,它会给出如下错误:

ReferenceError: require is not defined
Run Code Online (Sandbox Code Playgroud)

它正在打印上面定义的console.log.

node.js angularjs

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

创建模式时"缺少授权条款"

我正在尝试使用Enterprise Manager Console在Oracle中创建数据库模式,如下所示:

CREATE SCHEMA SCM AUTHORIZATION SCM
Run Code Online (Sandbox Code Playgroud)

但它给出了错误:"缺少AUTHORIZATION子句".

你能帮忙吗?

database oracle schema

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

列表框在空时不显示错误

我正在使用列表框来通过文本框获取用户的输入.如果用户通过文本框提供输入,我可以解析列表框中的值并执行操作.现在如果用户没有给出任何输入,那么listbox不包含任何内容.我想如果列表框为空它应该在msg框中显示错误..我正在尝试我的代码,但它不工作..

string text1 = lstboxbulkto.ToString();
                if (lstboxbulkto.ToString().Equals(null))
                {
                    MessageBox.Show("hiii");
                }
Run Code Online (Sandbox Code Playgroud)

其中lstboxbulkto是列表框的名称.如何才能做到这一点.

.net c# listbox winforms

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

标签 统计

c# ×2

.net ×1

angularjs ×1

database ×1

html ×1

javascript ×1

listbox ×1

node.js ×1

object ×1

oracle ×1

reference ×1

schema ×1

winforms ×1