Jump to content

advanzd

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by advanzd

  1. but that'll mean i need 2 onClick attributes in one img tag :S
  2. Could i place the {document.getElementById('info').innerHTML=e.title;} inside the function Large(obj){ var imgbox=document.getElementById("imgbox"); imgbox.style.visibility='visible';var info=document.getElementById("info"); info.style.visibility='visible'; var img = document.createElement("img"); img.src=obj.src; img.style.width='700px'; img.style.height='auto'; if(img.addEventListener){ img.addEventListener('click',Out,false); } else { img.attachEvent('onclick',Out); } imgbox.innerHTML='<div style="float:right;z-index:99;"><img id="close" alt = "image" src = "images/close2.png" onmouseover = "this.src = Image_over.src;" onmouseout = "this.src = Image_out.src;" onClick="Out()" /></div>'; imgbox.appendChild(img); imgbox.style.left=(getElementLeft(obj)) +'px'; imgbox.style.top=(getElementTop(obj)) + 'px'; } ?and if i could, how?
  3. Well here's my problem. I'm making a image gallery and i have a script that enlarges a thumbnail when clicked (and a little part of it is used to have a image chang on mouseover, not really important), which looks like this: function Large(obj){ var imgbox=document.getElementById("imgbox"); imgbox.style.visibility='visible';var info=document.getElementById("info"); info.style.visibility='visible'; var img = document.createElement("img"); img.src=obj.src; img.style.width='700px'; img.style.height='auto'; if(img.addEventListener){ img.addEventListener('click',Out,false); } else { img.attachEvent('onclick',Out); } imgbox.innerHTML='<div style="float:right;z-index:99;"><img id="close" alt = "image" src = "images/close2.png" onmouseover = "this.src = Image_over.src;" onmouseout = "this.src = Image_out.src;" onClick="Out()" /></div>'; imgbox.appendChild(img); imgbox.style.left=(getElementLeft(obj)) +'px'; imgbox.style.top=(getElementTop(obj)) + 'px'; } function Out(){ document.getElementById("imgbox").style.visibility='hidden'; document.getElementById("info").style.visibility='hidden';}var Image_over = new Image();var Image_out = new Image();function Preload(){if (document.images){// set image urlImage_over.src = "images/close.png";Image_out .src = "images/close2.png";}} And what i want to do, is whenever a thumbnail gets clicked, the title of the thumbnail must be placed in a div called "info" as text. I've found a code on w3schools that's capable of writing a title, but i don't know how to make it write the title of the clicked thumb in the div i want. So here's the code to write a title: <script type="text/javascript">var x=document.getElementsByTagName('body')[0];document.write("Body title: " + x.title);document.write("<br />");document.write("An alternate way: ");document.write(document.getElementById('myid').title);</script> I'm hoping someone can help me out!
  4. Hello! I have a problem: I'm working on a one page layout with a one page jquery preset because i'm not good at jquery and javascript yet. It's not really a layout yet just trying to get the basic things working.So what happens is, on the first page/item of the layout there's a white bar above a div, but i didn't use any padding/margin yet. But on the rest of the pages there's no white bar: So is it in the jQuery or in the Html/css? And how do i fix it?
×
×
  • Create New...