简体   繁体   English

带有图像的Javascript鼠标悬停

[英]Javascript Mouseover with Image

^Here's my problem^ 这是我的问题^

I want the button «Generelt» (Generally in English) to be on the same line as all the others one (Startside, Nyheter, Fakta, Medlem etc.). 我希望按钮«Generelt»(一般用英语)与所有其他按钮(Startside,Nyheter,Fakta,Medlem等)在同一条线上。 I didn't fint out how I do that, so my question is simple how do I do that? 我没有弄明白我是怎么做到的,所以我的问题很简单,我该怎么做? I also want the «Generelt»-image to be in the same size as the «Donér» (Donate) button, but when the second image comes (where you can choose page) I want it to be in the size it is now, that would say the image switch/change size when you put your mouse on the image, but I still want it all on the same line. 我还希望«Generelt» - 图像与«Donér»(捐赠)按钮的大小相同,但是当第二张图像到来时(你可以选择页面)我希望它的大小与现在一样大,当你将鼠标放在图像上时,会说图像切换/改变大小,但我仍然希望它在同一行上。

Here's the source in question: 这是有问题的来源:

<A HREF="default.php"
   onMouseOver="hiLite('img01','startside2')"
   onMouseOut="hiLite('img01','startside1')"><IMG SRC="startside1.gif" WIDTH="124" HEIGHT="28" BORDER="0" ALT="" NAME="img01"></A>

<A HREF="nyheter.htm"
   onMouseOver="hiLite('img02','nyheter2')"
   onMouseOut="hiLite('img02','nyheter1')"><IMG SRC="nyheter1.gif" WIDTH="87" HEIGHT="28" BORDER="0" ALT="" NAME="img02"></A>

<A HREF="fakta.htm"
   onMouseOver="hiLite('img03','fakta2')"
   onMouseOut="hiLite('img03','fakta1')"><IMG SRC="fakta1.gif" WIDTH="78" HEIGHT="28" BORDER="0" ALT="" NAME="img03"></A>

<A HREF="medlem.htm"
   onMouseOver="hiLite('img04','medlem2')"
   onMouseOut="hiLite('img04','medlem1')"><IMG SRC="medlem1.gif" WIDTH="86" HEIGHT="28" BORDER="0" ALT="" NAME="img04"></A> 

<SCRIPT LANGUAGE="javascript"><!--
document.write("<P><A HREF=\"javascript:nada()\"><IMG SRC=\""+picture_source+"\" width=124 height=76 NAME=\"img05\" border=0 USEMAP=\"#dir1\"></A>");
   //--></SCRIPT>
</SCRIPT>
<NOSCRIPT>
   <IMG SRC="generelt2.gif" WIDTH="124" HEIGHT="28" BORDER="0" USEMAP="#dir2" ALT="Directory: Home-Mail-Links">
</NOSCRIPT>

How would I do this? 我该怎么做?

EDIT: How would I make a display: inline-block and where should I put it? 编辑:我将如何进行显示:内联块,我应该把它放在哪里? I need it so that I can have it on the same line, as said before. 我需要它,以便我可以在同一条线上,如前所述。

Full site here: http://christofferhn.comoj.com/help.htm 完整网站: http//christofferhn.comoj.com/help.htm

A paragraph is a block-level element, which will naturally drop to a new line. 段落是块级元素,它自然会下降到新行。 You need to use a span as a wrapper, or apply display: inline-block to the element you do use. 您需要使用span作为包装器,或将display: inline-block应用于您使用的元素。

I'd reconsider your approach here. 我在这里重新考虑你的方法。 It's very non-standard, which means it'll be confusing for users, and it's probably not very accessible to those with handicaps at all. 这是非常不标准的,这意味着它会让用户感到困惑,对于那些有障碍的人来说,它可能不太容易接近。

Drop the <P> element inside the document.write and you will probably get what you want. 删除document.write中的<P>元素,你可能会得到你想要的。

I have to agree with isherwood though, the way that you are setting up your website is very non-standard and you should very much rethink it. 我不得不同意isherwood,你设置你的网站的方式是非标准的,你应该重新考虑它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM