小编Gee*_*Out的帖子

为什么通过Javascript显示/隐藏HTML元素会将其置于新行?

我有这个页面:http://www.problemio.com/problems/problem.php ?problem_id = 214

在它上面有一个链接"建议解决方案"朝向屏幕的中间底部.如果单击它,它会调用JS函数来隐藏它,并在其位置显示diff元素.由于某种原因,它将另一个元素放在下一行看起来很尴尬.

你知道为什么会这样吗?我无法弄清楚:)

html javascript

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

如何在同一水平对齐上放两个按钮?

我在JavaScript中制作HTML表单并且它可以工作,但是两个按钮:取消和提交是在单独的行(一个在另一个之上).如何使它们水平对齐?

这是我的代码:

var new_comment_form = "<form id='add_comment' method='post'><textarea name='problem_comment' cols=60 rows=6 id='problem_comment'>" + problem_comment_text + "</textarea><input type='hidden' id='problem_id' name='problem_id' value='" + problem_id + "' /><input type='hidden' id='problem_comment_id' value='" + problem_comment_id + "' /><input type='submit' class='button' value='Edit Message' /><input type='button' class='button' id='cancel_comment' data-problem_id='" + problem_id + "' value='Cancel' /></form>";
Run Code Online (Sandbox Code Playgroud)

顺便说一句,它看起来非常凌乱:)人们通常如何做这种事情,以便更清洁?

谢谢!

html javascript css

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

从PHP创建的HTML发送文本

我有一些从数据库中得到的文本,如下所示:

$solution = $row['solution'];
Run Code Online (Sandbox Code Playgroud)

然后我使用这个变量在PHP中创建了一些HTML:

echo '<a class="delete_suggested_solution" data-problem_id="'.$problem_id.'" data-suggested_solution_id="'.$suggested_solution_id.'" href="#">Delete</a> | <a href="#" class="edit_suggested_solution" data-problem_id="'.$problem_id.'" data-suggested_solution_id="'.$suggested_solution_id.'" data-solution_text="'.$solution.'" data-solution_title="'.$solution_name.'">Edit</a>';
Run Code Online (Sandbox Code Playgroud)

在大多数情况下,这实际上工作正常,但是当$解决方案中有这样的链接时,<a href="http://SomeUrlWhatever.com">something</a>这个HTML会在显示时打破页面上的HTML.

有没有什么可以做的,以便页面上的HTML不会被破坏?

谢谢!!

html php

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

Android 开发 - Eclipse 无法识别 CurrentActivity 和 LatestActivity 类

我运行了 HelloWorld android 应用程序,现在我开始制作按钮之类的东西。我能够在布局 xml 和所有这些中创建按钮,但是我遇到了一些关于 Eclipse 无法识别我的 Intent 声明的困惑。

下面是一段代码:

addProblemButton.setOnClickListener(new Button.OnClickListener() 
{  
    public void onClick(View v) {
      Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class);
      CurrentActivity.this.startActivity(myIntent);
    }
});
Run Code Online (Sandbox Code Playgroud)

CurrentActivity 和 NextActivity 类似乎无法识别,Eclipse 并没有给我自动创建导入语句的选项。

这些类所在的包是什么?是不是有些东西不认识的问题?或者一些需要安装/下载的包?处理这种情况的最佳实践方法是什么?

另外,如果我已经将按钮添加到布局中,是否还需要添加侦听器?

谢谢!

android android-intent android-layout

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

Android - 为什么两个TextView元素并排排列而不是下一个?

我有这个布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

<TextView
    android:id="@+id/solution_title"    
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Label1"
    />  

<TextView
    android:id="@+id/solution_description"    
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Label2"
    />  

    <ListView
    android:id="@android:id/list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label"
        android:textSize="20px" >        
    </ListView>

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

我将两个TextView元素与ListView组合在一起.出于某种原因,TextView项目彼此相邻而不是一个在另一个之下.为什么会这样?我如何让它们一个接一个排列?

谢谢!

android android-layout

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

为什么equals可能不会返回true

我有这个字符串:"no_questions_by_user"在一个名为result的变量中.

比我检查:

if ( result != null && result.equals( "no_user_id" ) )
{
        Log.d( "Post execute: " , "NOOOT  OKKKK - no user id" );    
}
else
if ( result != null && result.equals( "database_error" ) )
{
        Log.d( "Post execute: " , "NOOOT  OKKKK - database error" );    
}
else
if ( result != null && result.equals( "no_questions_by_user" ) )
{           
        Log.d( "Post execute: " , "NOOOT  OKKKK - no questions by user so far" );   
} …
Run Code Online (Sandbox Code Playgroud)

java equals

0
推荐指数
2
解决办法
181
查看次数

标签 统计

html ×3

android ×2

android-layout ×2

javascript ×2

android-intent ×1

css ×1

equals ×1

java ×1

php ×1