在我的班级"Server.cs"中,我想从表单中访问文本框.我尝试使用此代码:
ServerWindow.WriteChatlog(encoder.GetString(message, 0, bytesRead));
Run Code Online (Sandbox Code Playgroud)
但我得到了这个错误:
An object reference is required for the non-static field, method, or property 'Chat_Server.ServerWindow.WriteChatlog(string)
Run Code Online (Sandbox Code Playgroud)
ServerWindows.WriteChatlog(字符串文本)如下所示:
public void WriteChatlog(string text)
{
textBox1.Text += text + Environment.NewLine;
}
Run Code Online (Sandbox Code Playgroud)
现在我尝试直接从我使用ServerWindow.WriteChatlog方法的地方这样做,但它没有用.
它们都是非静态的
我已经制作了一个代码,但我无法放大:
function drawMap() {
var tileH = 31;
var tileW = 61;
for (i = 0; i < map.length; i++) {
for (j = 0; j < map[i].length; j++) {
var drawTile = map[i][j];
var xpos = (i - j) * tileH + mapX;
var ypos = (i + j) * tileH / 2 + mapY;
ctx.drawImage(tileImg[drawTile], xpos, ypos);
if (i == xmouse && j == ymouse) {}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如何使用javascript放大这个?
例子:
<script type="text/javascript">
function test() {
console.log("Hello world");
}
</script>
Run Code Online (Sandbox Code Playgroud)
我该怎么称呼test()
?
编辑:我没有正确解释这一点。
我正在使用 node.js 的请求模块来加载包含 javascript 函数的外部 html 文件:
request.get(options, function (error, response, body) {
if (error && response.statusCode !== 200) {
}
else {
jsdom.env({
html: body,
scripts: ["../jquery-1.6.4.min.js"]
}, function (err, window) {
var $ = window.jQuery;
Run Code Online (Sandbox Code Playgroud)
我只是在寻找在“body”中调用函数的语法。
我只是想知道.net框架中是否有任何内置,我可以轻松返回两个数字之间的增量?我编写的代码可以做到这一点,但听起来应该已经在框架中了.
我在jQuery中遇到'if else if'函数的问题.根本没有检测到我的代码的最后两个语句,所以当我希望加载页面时没有任何反应.有人知道这有什么问题吗?
function pageloader() {
var position = $('#slideInner').css('marginLeft');
if (position >= '-936px') {
// load the page contents
$('#blogs').load('pagetwo.html #blog');
// hide the loading box
loadoff();
$('#portfolio').empty();
}
else if (position = '-1872px') {
$('#portfolio').load('pagethree.html #homepage');
loadoff();
$('#blogs').empty();
}
else if (position = '-2808px') {
$('#contact').load('pagefour.html #homepage');
// hide the loading box
loadoff();
}
else {
alert('all posibilities exausted');
}
}
Run Code Online (Sandbox Code Playgroud) 我一直在努力寻找解决问题的方法.Firebug说语法错误,JSHint说"预期标识符而不是'var'." 在第4行(var test1 = [)你能告诉我为什么会发生这个错误吗?谢谢!
function name() {
if (
var test1 = ['selected': -1, 'AF': 0.02];
var selectedTest1 = $('#test1').val();
var rate = rates(selectedTest1);
var callMinutes = document.calc.minutes.val();
document.calc.pay.value = selectedTest1 * callMinutes;)
else(
(document.calc.test1.value == null) || (document.calc.minutes.value == null || document.calc.minutes.value.length == 0)) {
document.calc.pay.value = "Incomplete data";
}
};
Run Code Online (Sandbox Code Playgroud) javascript ×4
c# ×2
c#-4.0 ×1
html ×1
html5 ×1
if-statement ×1
jquery ×1
jsdom ×1
math ×1
node.js ×1
syntax-error ×1