小编Ice*_*gon的帖子

具有随机像素颜色的100x100图像

我正在尝试制作一个100x100图像,每个像素都是不同的随机颜色,如下例所示:

在此输入图像描述

我试过用,matplotlib但我运气不好.我应该使用PIL吗?

python image matplotlib draw python-imaging-library

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

在JavaScript中有多个IF和ELSE IF

所以被推到这个数组的依赖于几个无线电盒.我有这个标准和轮椅座位:

if(document.getElementById('standardseat').checked) {
  //Standard seat is checked
seatsArray.push(e.posX, e.posY);
}
else if(document.getElementById('wheelchairseat').checked) {
  //Wheelchair seat is checked
seatsArray.push("Wheelchair " + e.posX, e.posY);
}
Run Code Online (Sandbox Code Playgroud)

这是等效的表单代码:

<input id="standardseat" type="radio" name="seat" value="standard" /> Standard seat
<input id="wheelchairseat" type="radio" name="seat" value="wheelchair" /> Wheelchair seat
Run Code Online (Sandbox Code Playgroud)

但我想增加一些与标准/轮椅座位分开的收音机盒:

<input id="backnave" type="radio" name="area" value="backnave" /> Back Nave
<input id="frontnave" type="radio" name="area" value="frontnave" /> Front nave
<input id="middlenave" type="radio" name="area" value="middlenave" /> Middle nave
Run Code Online (Sandbox Code Playgroud)

我希望推动也包括这一点.为了解释,如果用户勾选"轮椅座位"和"中间中殿",则应输出推送("MN,Wheelchair"+ e.posX,e.posY).有没有办法让这种情况发生而不用手动包括很多其他如果每个可能的结果(我甚至可能想添加第三组无线电盒)?

谢谢!

javascript arrays if-statement push radio-button

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

CS0120:需要对象引用

将表单提交到savetext.aspx操作文件时出现此错误:

Compiler Error Message: CS0120: An object reference is required for the nonstatic field, method, or property 'System.Web.UI.Page.Request.get'
Run Code Online (Sandbox Code Playgroud)

在这一行:

string path = "/txtfiles/" + Request.Form["file_name"];
Run Code Online (Sandbox Code Playgroud)

整码:

<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>

<script runat="server">

class Test 
{
    public static void Main() 
    {
        string path = "/txtfiles/" + Request.Form["file_name"];
        if (!File.Exists(path)) 
        {
            using (StreamWriter sw = File.CreateText(path)) 
            {
                sw.WriteLine(request.form["seatsArray"]);
            sw.WriteLine("");
            }   
        }

        using (StreamReader sr = File.OpenText(path)) 
        {
            string s = "";
            while ((s = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net compiler-errors

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