dreamweaver中我想点 【关闭窗口】 然后窗口就关闭了,请问怎么设置链接?就是链接栏里填啥?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dreamweaver中我想点 【关闭窗口】 然后窗口就关闭了,请问怎么设置链接?就是链接栏里填啥?相关的知识,希望对你有一定的参考价值。
【关闭窗口】是自己输入的文字,想给它做链接。
< a href=“/”onclick=“javascript:window.close(); return false;”>关闭窗口< /a>追问谢谢你,我记得返回主页是直接在链接栏里输入# 但忘了关闭窗口是什么了,这不是代码,我代码学的还不是很好,还是想知道不用代码直接在链接栏里输入什么,还是谢谢你的回答……
参考技术A 链接栏里面填写关闭窗口的代码?那还叫链接栏么?链接是做什么的?就是打开新窗口。你怎么跟dreamweaver对着干?
关闭窗口的功能,dreamweaver没有提供可视化操作,必须要自己输入代码。
楼上给的代码是可以的,也可以把javascript外置,更规范一些。本回答被提问者采纳
在片段中我想点击如何显示警告对话框
我在Activity中使用导航菜单。当我点击菜单时,它会转到特定的片段,那时我给addtobackstack(null)
。我想解决这两个问题:
- 我想在后面的片段中通过弹出窗口显示
do you want to exit app
- 假设我从片段A遍历到B然后从B遍历到C.如果我在片段C中回放我想要进入主页面,而不显示片段B.
这是我的家庭活动:
package school.wyse.app.activities;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
public class ParentHomeActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
ServerUtils servutil;
GridLayoutManager grid;
Toolbar toolbar;
private View navHeader;
LinearLayout profile;
ImageView msglist;
ArrayList<StudentProfile> lang_list_new;
public RecyclerView studentsListRecyclerView;
public ParentMenuDashoard mStudAdapter;
StudentProfile[] profiles;
private StudentProfile[] studentCachedData;
Context ctx;
DrawerLayout drawer;
ImageView imageViewstaff;
String tenent_id,profilename,image,userphone;
Integer id,roleid;
String backStateName;
TextView profile_phone,profile_name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
setContentView(R.layout.activity_parent_home);
backStateName = this.getClass().getName();
ctx=this;
Toast.makeText(ctx, "backStateName--"+backStateName, Toast.LENGTH_SHORT).show();
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
navHeader=navigationView.getHeaderView(0);
studentsListRecyclerView = (RecyclerView) navHeader.findViewById(R.id.messageWindowRecycler);
ParentDashboard parentDashboard = new ParentDashboard();
FragmentManager manager = getSupportFragmentManager();
manager.beginTransaction().replace(R.id.content_frame, parentDashboard, parentDashboard.getTag()).commit();
toolbar.setTitle("Dashboard");
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onBackPressed() {
try {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
/* if (id == R.id.action_msg) {
return true;
}*/
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_dashboard) {
ParentDashboard parentDashboard = new ParentDashboard();
FragmentManager manager = getSupportFragmentManager();
manager.beginTransaction().replace(R.id.content_frame, parentDashboard, parentDashboard.getTag()).addToBackStack(null).commit();
//toolbar.setTitle("Dashboard");
} else if (id == R.id.nav_teachers) {
TeacherList teacherList = new TeacherList();
FragmentManager manager = getSupportFragmentManager();
// manager.beginTransaction().replace(R.id.id_content_frame, accountsMenuListFragment, "AccountsMenu").addToBackStack(" ").commit();
manager.beginTransaction().replace(R.id.content_frame, teacherList, teacherList.getTag()).addToBackStack(null).commit();
// toolbar.setTitle("Teachers");
} else if (id == R.id.nav_attendance) {
AttendanceFragment attendanceFragment = new AttendanceFragment();
FragmentManager manager = getSupportFragmentManager();
manager.beginTransaction().replace(R.id.content_frame, attendanceFragment, attendanceFragment.getTag()).addToBackStack(null).commit();
// toolbar.setTitle("Attendance");
} else if (id == R.id.nav_consumablity) {
ParentConsumablityFragment parentConsumablityFragment = new ParentConsumablityFragment();
FragmentManager manager = getSupportFragmentManager();
manager.beginTransaction().replace(R.id.content_frame, parentConsumablityFragment, parentConsumablityFragment.getTag()).addToBackStack(null).commit();
// toolbar.setTitle("Attendance");
}
else {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
好的,抱歉迟到的回复
这部分是你的活动的onBackPressed()
,它基本上检查你是否附加了片段(因此它不会执行本机后退,这会关闭应用程序)
if (childFragments.size() > 0) {
if (childFragments.get((childFragments.size() - 1)) != null) {
childFragments.remove(childFragments.size() - 1);
return;
}
}
每次你add/remove
片段:)所有你需要做的是attach / detach
项目到这个数组:)
对于您处于片段C并且想要返回到片段A而不显示片段B的特定情况,我建议您创建一个公共函数,从ArrayList
中除去最后一个片段(从位置0)删除所有片段
- 在主要活动中使用以下代码,您要显示appexit:
@Override public void onBackPressed() { if (doubleBackToExitPressedOnce) { super.onBackPressed(); finish(); return; } this.doubleBackToExitPressedOnce = true; Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show(); new Handler().postDelayed(new Runnable() { @Override public void run() { doubleBackToExitPressedOnce = false; } }, 2000);
} - 将片段A移动到B时,不要添加“addbackstack”。将片段B移动到C时添加“addbackstack(”C“)”
首先,你必须处理你的第二个问题,因为它将导致第一个问题的轻松处理,因此你必须注意如何启动片段,以便总是在回击时始终到达第一个片段导致当前片段的片段流,为此,只需启动片段,如下所示:
/**
* To initiate any fragment
*/
private void showAnyFragment(Fragment fragmentToShow) {
getSupportFragmentManager().popBackStack();
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.content);
frameLayout.setVisibility(View.VISIBLE);
getSupportFragmentManager().beginTransaction()
.replace(R.id.content, fragmentToShow)
.addToBackStack(null)
.commit();
}
/**
* When (for a reason) you want to initiate the main fragment (FragmentA)
*/
private void homeClicked() {
getSupportFragmentManager().popBackStack();
}
现在,fragmentA
是你的主要片段,当从A
到B
到C
到D
并点击后退按钮它会直接回到A
。
来到你的第二个问题,它将是直截了当的,因为你已经只保留fragmentA
总是在后面的堆栈中,所以除非显示除onBackPressed()
is之外没有其他片段(例如,如果你在这里),将不会调用该活动的FragmentA
函数fragmentC
和你单击后退按钮,将不会调用onBackPressed()
函数),所以当你进入活动的onBackPressed()
函数时,你确定当前正在运行的片段是FragmentA
这是你的主要页面片段。
因此,如果你想在用户试图退出应用程序时显示一个弹出窗口(他将在FragmentA
和hiitting Back),你所要做的就是覆盖保存片段的onBackPressed()
的MainActivity
方法:
@Override
public void onBackPressed() {
// the user here is in FragmentA(main page),
and he is clicking back to exit the app.
// TODO show popup here or do whatever you want
}
以上是关于dreamweaver中我想点 【关闭窗口】 然后窗口就关闭了,请问怎么设置链接?就是链接栏里填啥?的主要内容,如果未能解决你的问题,请参考以下文章