johnkiax Posted July 28, 2008 Posted July 28, 2008 Hello. First than all, sorry for my bad english i will trie to explain my problem. I create a rustic banner system. Is a iframa into the index and a html code change the image random. Is simple i add in the index.php the follow code: <iframe src="http://www.DOMAIN.XXX/shop/images/banners/random.html" width="565" height="102" scrolling="no" border="0" style="border:none;" frameborder="0"></iframe> and in the random.html the follow code: <html><head> <script language=javascript> <!-- var b1dis = "<a href=\""; var bdis = "\"><img src=\""; var edis = " width=\"565\" height=\"102\" alt=\"Banners\" border=\"0\"></a>"; var rnumb = ""; var img = ""; rnumb += Math.floor(Math.random()*3); img = rnumb; if (img == "0") { document.write(b1dis+ "http://www.DOMAIN.XXX/shop/product_info.php?cPath=62&products_id=190" +bdis+ "banner01.gif\"" +edis); } if (img == "1") { document.write(b1dis+ "http://www.DOMAIN.XXX/shop/index.php?cPath=63" +bdis+ "banner02.gif\"" +edis); } if (img == "2") { document.write(b1dis+ "http://www.DOMAIN.XXX/shop/index.php?cPath=66" +bdis+ "banner03.gif\"" +edis); } // --> </SCRIPT> <title>Random Banners</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body background="images/bg01.gif" bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> </body> </html> Thats all. My problem is than when one user click in the banner, the link open in the iframe and not in all the web. How can i do to when the user make a click in the banner open in the some explorer? Thanks for all =)
Guest Posted July 28, 2008 Posted July 28, 2008 John, I don't see that you have made an <a href=> that would make the banners 'clickable' however if I missed it, or you just didn't upload that snippet of code, you can always make an <a href=> open in the same browser by adding: target="_self" This will open it in the same frame. Chris
johnkiax Posted July 29, 2008 Author Posted July 29, 2008 DunWeb, thanks that havent a <a href=> because is javascript i dont know the javascript work but in if (img == "0") {document.write(b1dis+ "http://www.DOMAIN.XXX/shop/product_info.php?cPath=62&products_id=190" +bdis+ "banner01.gif\"" +edis); if the random said: IMG 0 - on click go to http://www.DOMAIN.XXX/shop/product_info.ph...products_id=190 and show image banner01.gif. The problem is when i click in the "banner" the new url is open in the IFRAME and not in the explorer.
arietis Posted August 4, 2008 Posted August 4, 2008 The problem is when i click in the "banner" the new url is open in the IFRAME and not in the explorer. i think the problem is your iframe. it's behaving exactly the way iframes are designed to. i'm sure there's a way to do it, but probably not with a <a href=> tag. maybe set up a <div onclick=> and in the onclick, have it walk up the tree of documents and set the document.location to the href that you want in your original <a> tag. there might be a little more involved, but that's the general idea. but, having said that, i think you're better off not using an iframe. is there a specific reason that you are using iframes? could you use a <div> instead? if there's another way to do that, it would make this part work the way you want it.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.