为什么hover实现不了后面的dispalynone隐藏的图片

图片说明
因为图片只能上传1张,看不懂的最好还是加我qq419046018给你发完这个区域完整的代码和图片!谢谢!!!!

4个回答

ul又不是a的子元素,当然没效果了。兄弟节点要用兄弟选择器 +

 .menuchanpinlan>a:hover + ul li{display:block}
.menuchanpinlan:hover ul {
    display:block;
}

我觉得a不应该出现在这里,在你的代码中a与ul是同级的,应该将a去掉,你应该是想当鼠标经过li中的a时隐藏显示(我猜的),可以试试下边的

.menuchanpinlan ul :hover  a {
                display:block;
}

应该直接通过js添加a的hover事件,改变对应ul的展示

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
为什么实现不了hover显示display:none隐藏的图片
![![图片说明](https://img-ask.csdn.net/upload/201808/04/1533352698_327648.png)图片说明](https://img-ask.csdn.net/upload/201808/04/1533352685_778427.png)
hover为什么背景变不了
[img=https://img-bbs.csdn.net/upload/201611/30/1480468471_476146.png][/img][img=https://img-bbs.csdn.net/upload/201611/30/1480468481_949404.png][/img]rn第一张是鼠标移动之前 背景是浅灰色的 鼠标移动之后背景变成白色 图片稍微放大 怎么都没办法实现背景变成白色 求各位大神帮我看看啊rn下面是代码rnrnrnrn rn rn 无标题文档rn rnrnrnrn rn rnrn rnrnrn rnbabababrnrnrnrnrnrn图片放大是实现了 背景没办法变成白色[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/54.gif][/img]
hover后改变图片样式
图片hover下改变图片的样式
窗体为什么隐藏不了......
在JAVA中,在A窗体上有一个JButton,当我单击JButton时,隐藏A窗体,而显示B窗体,如何实现(注:类似于VB中的:rn Private Sub JButton_click()rn A.Hide //A为按钮JButton所在的窗体rn B.Show //B为另一个窗体rn End Subrn)?
为什么我的 隐藏不了?
为什么我的 隐藏不了?rnrnrn代码如下:rn============================================rn rn rn 咨询人数:rn rn rn rn rn================================================rnrn就是隐藏不了?奇怪了!!!rn
hover 右侧的 | 隐藏
实现下图所示效果 鼠标经过的时候没有右侧的 |。一般的方法是用border-right。可是鼠标经过后一个a链接的时候,border-right还在。后来想的是在a链接下面加span标签,可是实现起来总是不对 a:hover span{display:none} 仅仅是鼠标经过的时候这个a链接下面的span隐藏,当鼠标 hover后一个a链接的时候span 还是在。同border-rig
webservice: 为什么储存不了图片?(byte[]后)
//转换byte[]rnpublic byte[] ByteFromPicBox(Image PicImage)rnrn if(PicImage == null)rn rn return null;rn rnrn MemoryStream MStream = new MemoryStream();rn PicImage.Save(MStream, ImageFormat.Jpeg);rnrn long ImageLen = MStream.Length;rn byte[] buffer = new byte[ImageLen];rnrn MStream.Read(buffer, 0, Convert.ToInt32(ImageLen));rn MStream.Close();rnrn return buffer;rnrnrn//调用rneProductSort.ImageByte = objPicture.ByteFromPicBox(pbSortPic.Image);rnrn============= 远程 ============rn保存rnpublic void SaveByByte(byte[] ImageByte, string Filename)rnrn if(ImageByte.Length > 0)rn rn //定义并实例化一个内存流,以存放提交上来的字节数组。rn MemoryStream m = new MemoryStream(ImageByte);rn //定义实际文件对象,保存上载的文件。rn FileStream f = new FileStream(Filename +".jpg", FileMode.Create);rn //把内内存里的数据写入物理文件rn m.WriteTo(f);rn m.Close();rn f.Close();rn f = null;rn m = null;rn rnrnrn//调用rnobjPicture.SaveByByte(eProductSort.ImageByte, AppPath() + SortID);rnrn为什么无论客户端选择多大的图片保存,远程都有是一个只有2到3K的文件
图片挡住了hover的图片
我希望当鼠标指出图片时,图片右上角出现关闭的图标,但以下代码里,a:hover图标被a包住的图片挡住了,请问如何解决?rnrn[code=HTML]rnrnrnrn rn 无标题文档rn rnrnrnrn rnrnrn[/code]
附件隐藏问题:为什么我隐藏不了?
B/S;rn我创建了$V2AttachmentOptions域,rnrn问题1,rn我在lotusscript代理中不能使用这个语句,“doc.$V2AttachmentOptions=0”这是为什么?rnrn问题2,rn我在代理中使用下面这个语句将$V2AttachmentOptions域的值由1改为0,但是附件仍然显示,这是为什么?rnSet item = doc.replaceitemvalue("$V2AttachmentOptions",0)
:hover放前面和放后面的区别
.box .front:hover表示的是当鼠标移动到box中的front上时的front样式变化。  .box:hover .back  .box:hover .front 表示的是当鼠标移动到box上面的时候front和back的样式变化  .box .front:hover {             transform:rotateY(180deg);         }
hover很简单的效果实现不了,求大神
就是,鼠标停在UL上的时候,显示隐藏的li,现在不显示,忙了一晚上了,求大神。。。。。rn rnrnrn rn loop $data $rrn rn $r[catname] | rn rn rn loop subcat($r[catid]) $rrrn $rr[catname]rn /looprn rn rn rn /looprn /pcrn rn
为什么一级菜单隐藏不了
下面的二级、三级菜单可以隐藏,一级菜单却隐藏不了。怎么回事。
为什么我的窗体隐藏不了?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clickrn Dim mydataadapter As New SqlDataAdapter("select * from 用户表", SqlConnection1)rn Dim mydataset As New DataSet()rn mydataadapter.Fill(mydataset)rn Dim myarray(20)rn Dim myarray2(20)rnrn Dim i As Integerrn For i = 0 To mydataset.Tables(0).Rows.Count - 1rn myarray(i) = CStr(mydataset.Tables(0).Rows(i).Item(0))rn Next irnrn For i = 0 To mydataset.Tables(0).Rows.Count - 1rn myarray2(i) = CStr(mydataset.Tables(0).Rows(i).Item(1))rnrn Nextrn For i = 0 To mydataset.Tables(0).Rows.Count - 1rn If Trim(username.Text) = myarray(i) And Trim(password.Text) = myarray2(i) Thenrn sales.Show()rn market.Hide() <-*************************rn Exit Subrnrn End Ifrn Nextrn MsgBox("用户名与密码不符", MsgBoxStyle.OKOnly, "警告")rnrn rn End Subrnrn Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Clickrn Endrnrn End Subrn大家帮忙看看
我的弹出窗口为什么隐藏不了
我想把弹出窗口移至屏幕以外:rnwindow.open("", "", "left=3000");rnrn页面代码量小的时候成功了,但是我发现一旦代码量大了就出现了这样的情况:rn弹出窗口右侧靠齐了屏幕右侧,整个弹出窗口都显示在屏幕上。有人能告诉我这是什么缘故吗?rnrn先行谢过了!
我的form为什么隐藏不了
在create事件中用visible:=false不行,用form.hide也不行,撞鬼了。
为什么装载不了图片???
我按书上:rn Toolkit t=getToolkit();rn Image im =t.getImage("0001.jpg");rn System.out.print(im.getWidth(this));rn为什么结果总是-1rn是不是代表图片装载失败??、
图片为什么显示不了
这在个文件夹里面我有这张图片啊,为什么却总说找不到文件呢,是不是路径有问题啊,大家帮我改改,多谢了.rnprocedure TForm1.Button1Click(Sender: TObject);rn varrn tempfile:string;rnbeginrnrn tempfile:='F:\图片\新建文件夹\新建文件夹 (2)\1.jpeg';rn image1.Picture.LoadFromFile(tempfile)rn end;rnrnend.rn
为什么看不了图片
我是WIN2K的操作系统,可是突然发现,我的浏览器有一些图片下不了了rn显示:一个方框里有个x,不知道那里可以解决这个问题啊 rn
图片为什么显示不了?
我用JCreator进行编译,图片放在了D:\Program Files\Xinox Software\JCreatorV3\Templates\Template_5\web\images下,为什么显示不了?我用JBuilder2005也同样无法显示,是不是图片放错地方了,应该放在什么地方啊|rnimport java.awt.*;rnimport java.awt.event.*;rnimport javax.swing.*;rnpublic class MyJButtonrn JFrame fr=new JFrame();rn JLabel j1=new JLabel("在标签上显示图片");rn Icon ico1=new ImageIcon("b3.gif");rn Icon ico2=new ImageIcon("b4.gif");rn Icon ico3=new ImageIcon("b11.gif");rn Icon ico4=new ImageIcon("b12.gif");rn Icon ico5=new ImageIcon("b9.gif");rn Icon ico6=new ImageIcon("b10.gif");rn JButton b1=new JButton("显示第一幅图片");rn JButton b2=new JButton("显示第二幅图片");rn JPanel p=new JPanel(new GridLayout(1,2,20,5));rn Font ft=new Font("Serif",Font.BOLD,18);rn public static void main(String args[])rn MyJButton that=new MyJButton();rn that.go();rn rn void go()rn fr.setTitle("JButton和JLabel的用法");rn BorderLayout br=new BorderLayout();rn fr.getContentPane().setLayout(br);rn fr.getContentPane().add("Center",j1);rn fr.getContentPane().add("South",p);rn b1.setToolTipText("单击该按钮将显示第一幅图片");rn b1.setPressedIcon(ico5);rn p.add(b1);rn b2.setToolTipText("单击该按钮将显示第二幅图片");rn p.add(b2);rn j1.setToolTipText("单击下面的按钮将在区域显示图片");rn j1.setFont(ft);rn b1.setFont(ft);rn b2.setFont(ft);rn fr.setLocation(300,500);rn fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn b1.addActionListener(new ButtonH1());rn b1.addMouseListener(new MouseH(1));rn b2.addActionListener(new ButtonH2());rn b2.addMouseListener(new MouseH(2));rn fr.setSize(400,300);rn fr.setResizable(true);rn fr.setVisible(true);rn rn rn rn public class ButtonH1 implements ActionListenerrn public void actionPerformed(ActionEvent e)rn j1.setIcon(ico1);rn rn rn rn class ButtonH2 implements ActionListenerrn public void actionPerformed(ActionEvent e)rn j1.setIcon(ico2);rn rn rn rn class MouseH extends MouseAdapterrn int sel;rn MouseH(int select)rn sel=select;rn rn public void mouseEntered(MouseEvent e)rn b1.setIcon(ico6);rn rn rn public void mouseExited(MouseEvent e)rn b1.setIcon(null);rn rn rn
为什么加载不了图片?
数据库已创建好,根据卡号获取姓名,再根据姓名查找显示图片。。。nnvoid CbitMapDlg::OnLoadBitMap()nn // TODO: 在此添加控件通知处理程序代码n CppSQLite3DB db;n db.open(L"meninfo.db");n CppSQLite3Query query = db.execQuery(L"select * from meninfo where cardNO = 123;");n LPCTSTR name = query.getStringField(L"name");n n //CBitmap bitmap;n TCHAR path[256] = 0;n swprintf((wchar_t*)path, L"FlashDisk\picSrc\%s.bmp",name);n //bitmap.LoadBitmap(IDB_BITMAP);n HBITMAP hbitmap = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),n path,//文件全路径n IMAGE_BITMAP,n 0,n 0,n 0x00002000|0x00000010);nn CDC dcCompatible;n CDC *pDC=GetDlgItem(IDC_PICTURE)->GetDC(); n dcCompatible.CreateCompatibleDC(pDC); nn dcCompatible.SelectObject(hbitmap);n n CRect rect; n GetDlgItem(IDC_PICTURE)->GetClientRect(&rect);n n BITMAP bmpInfo;n CBitmap cbitmap;n cbitmap.Attach(hbitmap);//由HBITMAP 得到关联的CBitmapn cbitmap.GetBitmap(&bmpInfo); // 由CBitmap 得到关联的BITMAP n pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight,SRCCOPY);n nnnn
为什么png图片在a:hover下透明失效了?
DD_belatedPNG.js 我用这个js文件解决IE6下透明的.rn但鼠标移动上去的背景不透明了.rn可有解决的办法啊?
请教高手:我下面的代码为什么隐藏不了桌面?
帮我看看吧:rn[DllImport("user32.dll",EntryPoint="ShowWindow")]rnpublic static extern int ShowWindow(int hwnd,int nCmdShow);rn[DllImport("user32.dll",EntryPoint="GetDesktopWindow")]rnpublic static extern int GetDesktopWindow();rnrnvoid Bt_desktopClick(object sender, System.EventArgs e)rn rn int hwnd=GetDesktopWindow();rn MessageBox.Show(hwnd.ToString());//用于检测,值是65566rn int disp=ShowWindow(hwnd,0);rn MessageBox.Show(disp.ToString());//显示的值是0rn rnrn为什么就是不隐藏桌面呢,郁闷ing!
hover事件-显示和隐藏敏感信息
&amp;lt;input type=&quot;text&quot;  id=&quot;show_hidden&quot; hidden_value=&quot;*********1235&quot; show_value=&quot;123456789&quot; value=&quot;***********&quot;/&amp;gt;        $('#show_hidden', _tabControl.Control).hover(           //bootbox.alert(&
图片hover时有遮罩
以往想到给图片加个蒙版遮罩,之前都会这样写 img{width:400px;} .div1{position: relative;display: inline-block;} .span1{position: absolute;top:0;bottom: 0;left:0;right:0;background: rgba(0,0,0,.5);display: none;z-index
H5图片浮动和Hover
有鼠标移动到上面是的显示效果
鼠标hover图片改变
实例:http://www.d3box.com/sample/hover-change.html 1. 看到很多站点,鼠标移动到产品图片上面图片就会切换的效果。通过查看相关的css代码,发现其实很简单。主要涉及到以下几个方面: 默认浏览器:chrome  定位:position 对图片定位 透明度:opacity 设置图片透明度 动画:transition  (可有可无)
图片hover向左滑动10px
图片hover向左滑动10px .diy-floor .shop-list li img { position: absolute; right: 0; bottom: 0; } .anim-left:hover img { -webkit-transform: translateX(-10px); -o-transform: translateX(-10...
css3动画:结合hover实现图片变换
Css3和hover结合产生的动画效果 开发工具与关键技术:DW css3、hover 作者:小明同学 撰写时间:2019/1/18 首先写一个关键帧在不同的时期引入不同的背景图片再加上css3的位移属性,设置背景图片的尺寸(也可以加上其它的属性,根据自己的需求) 然后调用动画结合hover就可以达到图片变换的效果 详细代码见下图: Anim...
为什么下面的语句执行不了?
declare rn v_char varchar(50);rnbeginrn rn create table temp_stu as select * from studentrn --v_char:='ok';rnend;rnrn为什么执行不了呢?
用hover实现图片遮罩层的出现和消失
用hover实现图片遮罩层的出现和消失 html部分 我在这里建立了三个盒子,可以看出div1里面包含div2和div3,div2和div3都是遮罩层。 遮罩层必须放在大盒子的里面 &lt;div class="div1"&gt; &lt;div class="div2"&gt; &lt;/div&gt; &lt;div class="div3"&gt; &lt;/...
hover后执行过渡效果
hover后执行过渡效果 元素标签上添加过渡的标准 :  .course-item{ position: relative; top:0; transition:box-shadow,top 0.5s; } hover 后要改变的内容 .course-item:hover{ box-shadow:0 2px 15px -2px #8b8b8b; ...
拍照后获取不了图片!
做了一个图片上传的程序,rn在模拟器里调试:拍照后获得的照片不是刚刚拍的那张,rn本地选定的图片可以获得选中图片!rnrn在HTC One x里测试:rn拍照和本地都获取不了图片!不知道是什么问题:rnrn[img=https://img-bbs.csdn.net/upload/201308/06/1375764672_483518.png][/img]rnrn[color=#FF0000]ShareActivity.java[/color]rn[code=java]public class ShareActivity extends Activity implements Serializable rnrn public static final int SELECT_PIC_BY_TACK_PHOTO = 1;// Camerarn public static final int SELECT_PIC_BY_PICK_PHOTO = 2;// Galleryrn // path-KEYrn public static final String SAVED_IMAGE_DIR_PATH = "photo_path";rn private static final String TAG = "ShareActivity";rnrn // pathrn private String picPath;rn private Intent lastIntent;rn private Uri photoUri;rnrn private RelativeLayout layout1;rn private RelativeLayout layout2;rnrn public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main_share);rnrn layout1 = (RelativeLayout) this.findViewById(R.id.upload_photo);rn layout2 = (RelativeLayout) this.findViewById(R.id.upload_gallery);rn lastIntent = getIntent();rnrn layout1.setOnClickListener(new OnClickListener() rn public void onClick(View v) rn takePhoto();rn rn );rn layout2.setOnClickListener(new OnClickListener() rnrn public void onClick(View v) rn pickPhoto();rn rn );rn rnrn private void takePhoto() rnrn String SDState = Environment.getExternalStorageState();rn if (SDState.equals(Environment.MEDIA_MOUNTED)) rnrn Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);rn rn ContentValues values = new ContentValues();rn photoUri = this.getContentResolver().insert(rn MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);rn intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, photoUri);rn startActivityForResult(intent, SELECT_PIC_BY_TACK_PHOTO);rn else rn Toast.makeText(this, R.string.takePhoto_msg, Toast.LENGTH_LONG)rn .show();rn rn rnrn private void pickPhoto() rn Intent intent = new Intent();rn intent.setType("image/*");rn intent.setAction(Intent.ACTION_GET_CONTENT);rn startActivityForResult(intent, SELECT_PIC_BY_PICK_PHOTO);rn rnrn @Overridern protected void onActivityResult(int requestCode, int resultCode, Intent data) rn if (resultCode == Activity.RESULT_OK) rn doPhoto(requestCode, data);rn rn super.onActivityResult(requestCode, resultCode, data);rn rnrn private void doPhoto(int requestCode, Intent data) rnrn if (requestCode == SELECT_PIC_BY_PICK_PHOTO) rn if (data == null) rn Toast.makeText(this, "选择图片文件出错", Toast.LENGTH_LONG).show();rn return;rn rn photoUri = data.getData();rn if (photoUri == null) rn Toast.makeText(this, "选择图片文件出错", Toast.LENGTH_LONG).show();rn return;rn rn rn String[] pojo = MediaStore.Images.Media.DATA ;rn Cursor cursor = managedQuery(photoUri, pojo, null, null, null);rn if (cursor != null) rn int columnIndex = cursor.getColumnIndexOrThrow(pojo[0]);rn cursor.moveToFirst();rn picPath = cursor.getString(columnIndex);rn cursor.close();rn rn Log.i(TAG, "imagePath = " + picPath);rn if (picPath != null) rnrn Intent startEx = new Intent(ShareActivity.this, PhotoPre.class);rn Bundle bundle = new Bundle();rn bundle.putString(SAVED_IMAGE_DIR_PATH, picPath);rn startEx.putExtras(bundle);rn setResult(Activity.RESULT_FIRST_USER, startEx);rn startActivity(startEx);rn else rn Toast.makeText(this, "选择文件不正确!", Toast.LENGTH_LONG).show();rnrn rnrn rn[/code]rnrn预览:[color=#FF0000]PhotoPre.java[/color] rn[code=java]public class PhotoPre extends Activity rn public static String picPath = null;rn private static final String TAG = "PhotoPreActivity";rnrn public static final String KEY_PHOTO_PATH = "photo_path";rn public static final String IMAGE_UNSPECIFIED = "image/*";rnrn private ProgressDialog progressDialog;rn private Button back;rn private Button upload;rn private Button cancel;rn private ImageView view;rn private Bitmap bm;rnrn public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.imageshow);rnrn back = (Button) this.findViewById(R.id.phtot_back);rn upload = (Button) this.findViewById(R.id.phtot_upload);rn cancel = (Button) this.findViewById(R.id.phtot_cancel);rn view = (ImageView) this.findViewById(R.id.photo_selected);rn progressDialog = new ProgressDialog(this);rnrn back.setOnClickListener(new ThisOnClickListener(0));rn upload.setOnClickListener(new ThisOnClickListener(1));rn cancel.setOnClickListener(new ThisOnClickListener(2));rnrn Bundle bundle = getIntent().getExtras();rn String path = bundle.getString(KEY_PHOTO_PATH);rn BitmapFactory.Options options = new BitmapFactory.Options();rn options.inJustDecodeBounds = true;rn bm = BitmapFactory.decodeFile(path);rn view.setImageBitmap(bm);rn rnrn protected void onActivityResult(int requestCode, int resultCode, Intent data) rn if (requestCode == 0) rn if (requestCode == 1) rn view.setImageBitmap(null);rn picPath = data.getStringExtra(ShareActivity.SAVED_IMAGE_DIR_PATH);rn Log.i(TAG, "最终选择的图片=" + picPath);rn Bitmap bm = BitmapFactory.decodeFile(picPath);rn view.setImageBitmap(bm);rn else if (requestCode == 2) rnrn try rn Bitmap bm = null;rn ContentResolver resolver = getContentResolver();rn Uri uri = data.getData();rn bm = MediaStore.Images.Media.getBitmap(resolver, uri);rnrn String[] pro = MediaStore.Images.Media.DATA ;rn Cursor cursor = managedQuery(uri, pro, null, null, null);rn int column_index = cursorrn .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);rn cursor.moveToFirst();rn String picPath1 = cursor.getString(column_index);rn Bitmap bitmap = BitmapFactory.decodeFile(picPath1);rn view.setImageBitmap(bitmap);rn cursor.close();rn catch (FileNotFoundException e) rn e.printStackTrace();rn catch (IOException e) rn e.printStackTrace();rn Log.e(TAG, e.toString());rn rn rn rn super.onActivityResult(requestCode, resultCode, data);rn rnrn public class ThisOnClickListener implements OnClickListener rn private int index = 0;rnrn private ThisOnClickListener(int i) rn index = i;rn rnrn @Overridern public void onClick(View v) rn switch (index) rn case 0:rn Intent intent = new Intent(PhotoPre.this, MainActivity.class);rn startActivity(intent); rn break;rn case 1:rn try rn postFile();rn catch (Exception e) rn e.printStackTrace();rn rn break;rn case 2:rn Intent intent1 = new Intent(PhotoPre.this, ShareActivity.class);rn startActivity(intent1);rn break;rn rnrn rnrn rnrn private void postFile() throws Exception rn progressDialog.setMessage("正在上传文件...");rn HttpClient httpclient = new DefaultHttpClient();rn httpclient.getParams().setParameter(rn CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);rnrn HttpPost httppost = new HttpPost("http://localhost:9002/upload.php");rn File file = new File("c:/TRASH/zaba_1.jpg");rnrn FileEntity reqEntity = new FileEntity(file, "binary/octet-stream");rnrn httppost.setEntity(reqEntity);rn reqEntity.setContentType("binary/octet-stream");rn System.out.println("executing request " + httppost.getRequestLine());rn HttpResponse response = httpclient.execute(httppost);rn HttpEntity resEntity = response.getEntity();rnrn System.out.println(response.getStatusLine());rn if (resEntity != null) rn System.out.println(EntityUtils.toString(resEntity));rn rn if (resEntity != null) rn resEntity.consumeContent();rn rnrn httpclient.getConnectionManager().shutdown();rn rnrnrn[/code]
为什么要隐藏实现?
RT
JSP为什么显示不了图片
我只是想简单显示一张图片,代码是下面这两行:rn<%@ page pageEncoding="GB18030"%>rnrn但为什么显示不了的?
不知道为什么保存不了图片。。。
import jsonrnimport rernfrom urllib.parse import urlencodernimport pymongo as pymongornfrom ppp import *rnimport lxmlrnimport requestsrnfrom bs4 import BeautifulSouprnfrom requests import RequestExceptionrnfrom hashlib import md5rnimport osrnrnrnclient = pymongo.MongoClient(MONGO_URL)rndb = client[MONGO_DB]rnrnrndef get_page_index():rn data=rn 'offset': '0',rn 'format': 'json',rn 'keyword':'四驱兄弟',rn 'autoload':'true',rn 'count': '20',rn 'cur_tab':'3',rn 'from':'gallery'rn rnrnrn url = 'https://www.toutiao.com/search_content/?'+ urlencode(data)rn response = requests.get(url)rn try:rn if response.status_code == 200:rn return response.textrn else:rn print('请求索引页出错')rn return Nonernrn except RequestException:rn return Nonernrndef qwer(html):rn data = json.loads(html)rn for item in data['data']:rn yield item.get('article_url')rnrndef open(url):rn response = requests.get(url)rn try:rn if response.status_code == 200:rn return response.textrn else:rn return Nonernrn except RequestException:rn print('请求详情页出错')rnrndef ww(html):rn soup = BeautifulSoup(html,'lxml')rn title = soup.select('title')[0].get_text()rnrn pattern = re.compile('JSON.parse\((.*?)\)', re.S)rn image = re.search(pattern,html)rn if image:rn result = json.loads(image.group(1))rn result = json.loads(result)rn print(result)rnrnrn for item in result.get('sub_images'):rn url = item.get('url')rn print('正在下载:',url)rn download(url)rn return rn 'tltle':title,rn 'url':urlrn rnrnrnrnrndef download(it):rn response = requests.get(it)rn try:rn if response.status_code == 200:rn return save(response.content)rn print(response.text)rn else:rn print('请求图片出错')rn return Nonernrn except RequestException:rn return Nonernrndef save(concent):rnrn file_path = '0/1.2'.format(os.getcwd(), md5(concent).hexdigest(), 'jpg')rn if not os.path.exists(file_path):rn with open(file_path, 'wb') as f:rn f.write(concent)rn f.close()rn ''' rn if os.path.exists(os.getcwd() + '\\images'):rn file_path = '0\\images\\1.2'.format(os.getcwd(), md5(concent).hexdigest(), 'jpg')rn else:rn os.mkdir(os.getcwd() + '\\images')rn file_path = '0\\images\\1.2'.format(os.getcwd(), md5(concent).hexdigest(), 'jpg')rnrn if not os.path.exists(file_path):rn with open(file_path, 'wb') as fp:rn fp.write(concent)rn '''rnrnrndef save_mongo(result):rn try:rn if db[MONGO_TABLE].insert(result):rn print('存储到Mongodb成功')rn return Truern else:rn print('这条存储失败了')rn except:rn print('333333')rnrndef main() :rn html=get_page_index()rn for url in qwer(html):rn html=open(url)rn url = ww(html)rnrnrnrnrnif __name__ == '__main__':rn main()rnrnrn在函数save处出错了rnTypeError: open() takes 1 positional argument but 2 were givenrn不是很理解。。。。
为什么图片就是显示不了!
代码如下:rnpackage prj_5_1;rn//ImageItemrnimport java.io.IOException;rnimport javax.microedition.lcdui.Display;rnimport javax.microedition.lcdui.Form;rnimport javax.microedition.lcdui.Image;rnimport javax.microedition.lcdui.ImageItem;rnimport javax.microedition.lcdui.Item;rnimport javax.microedition.midlet.*;rnrn/**rn * @author Administratorrn */rnpublic class Midlet_3 extends MIDlet rn private Form mainForm= new Form("ImageItem");rn private Display dis;rnrn private ImageItem imageItem;rn public Midlet_3()rn Image img = null;rn try rn Image createImage = Image.createImage("/img.png");rn catch (IOException ex) rn rn imageItem =rn new ImageItem("图片",img,ImageItem.LAYOUT_CENTER|Item.LAYOUT_EXPAND,"该图像无法转载");rn rnrnrn public void startApp() rn dis = Display.getDisplay(this);rn dis.setCurrent(mainForm);rn mainForm.append(imageItem);rn rnrn public void pauseApp() rn rnrn public void destroyApp(boolean unconditional) rn rnrn显示结果如下:[img=http://hiphotos.baidu.com/%BA%AB%BB%D4sir/pic/item/c3bab3d90a819abd77c63812.jpg][/img]rnrn我是在netbeans环境变量下编程的,新建的res文件也已经在库和资源中添加!!rn为何就是显示不了图片!!rnrn
为什么上传不了200K图片!
我有自己的一台服务器。装的是2000。rn用自己家里的电脑访问网站,并同时上传一张大于200K的图片,显示结果是该页无法打开(上传图片最大设置为500K)。但是我远程登陆服务器,然后访问网站,却可以上传200K的图片,这是什么原因造成的?rn我用的是动网论坛的无组件上传。
为什么图片会上传不了?
我以前从没碰过这种事情,rn用ftp软件上传图片到网站目录里,rn结果部分图片始终上传不上,rn提示文件出错,rn但在本机上查看和编辑都没有问题。rn最后我重新建立图片文件,把原来的几个图层拷贝过来,存成新的图片才可以上传。rn以上操作在photoshop中完成。rnrn有谁碰到过这种问题吗?rn这应该不会是病毒的原因吧。
为什么上传不了图片到文件夹?
要把一个图片上传到UpFile文件夹,是文件夹的共享设置还是什么问题?代码如下,哪位给看看如何改?rnprivate void btn_PostUp_Click(object sender, System.EventArgs e)rn rn string Path;rn string FileName;rn int Po;rn long FileSize;rn string fType;rn if(File1.PostedFile.FileName.Trim()!="") rn rn tryrn rn Path=Server.MapPath("\\BookShop\\UpFile").ToString();rn FileName=File1.PostedFile.FileName.ToString();rn fType=File1.PostedFile.ContentType; rn FileSize=File1.PostedFile.ContentLength; rn if(fType.Substring(0,5)!="image")rn rn ShowErrMsg("PostFile is not Image!");rn return;rn rn Po=FileName.LastIndexOf((char)92);rn FileName=FileName.Substring(Po+1,FileName.Length -Po-1);rn ViewState["PostFileName"]=FileName; rn File1.PostedFile.SaveAs(Path+"\\"+FileName); rn img_BookImg.ImageUrl="UpFile\\"+FileName;rn rn catch(Exception er)rn rn ShowErrMsg(er.Message);rn rn rn
为什么我删除不了图片?
E:\web\Myaspx\UpImages\SmallImages\2005211977.gif rn上面是我用response.write 显示出来的图片路径pathpicrn下面是删除图片的rn Dim Fi As FileInfo = New FileInfo(PathPic)rn Fi.Delete()rnrn在运行的过程中也没出现什么错误!rn就是删除不了图片!rn不知道怎么回事?
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数