kimmieblob Posted November 21, 2010 Share Posted November 21, 2010 IM trying to show some divs in a certain order. i want to show the first div twice then the second im using this and this just goes straight to the second div, i need it like this click div1, click div1, click div 2 <html> <head> <script language="JavaScript"> var oldHistLength = history.length; setInterval ( "checkHistory()", 100 ); function setVisibility(id, visibility) { document.getElementById(id).style.display = visibility; } function checkHistory() { if (oldHistLength != history.length) { setVisibility('div1', 'none'); setVisibility('div2', 'inline'); oldHistLength = history.length; } } </script> </head> <body> <div align="center" id="div2" style="position:center; display:none">some content</div> <div align="center" id="div1">some content i want to show twice</div> Quote Link to comment https://forums.phpfreaks.com/topic/219352-javascript-div-inline/ Share on other sites More sharing options...
Adam Posted November 21, 2010 Share Posted November 21, 2010 Could you explain what it is you're trying to do a little more? I'm not really following. Quote Link to comment https://forums.phpfreaks.com/topic/219352-javascript-div-inline/#findComment-1137449 Share on other sites More sharing options...
logicslab Posted November 23, 2010 Share Posted November 23, 2010 Hi Kimmi , I don't get Your Question Clear .... But I feel You like to Repeat the same Content Twice, I mean " some content i want to show twice", So if you Use jQuery 1.4.x You can implement same using like this code : <html> <head> <script type="text/javascript" src="jquery-1.4.4.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#div1").clone().appendTo("#div1"); }); </script> </head> <body > <div align="center" id="div2" style="position:center; display:none">some content</div> <div align="center" id="div1">some content i want to show twice</div> Regards Anes P.A Quote Link to comment https://forums.phpfreaks.com/topic/219352-javascript-div-inline/#findComment-1138328 Share on other sites More sharing options...
Adam Posted November 23, 2010 Share Posted November 23, 2010 logicslab, That's going to result in two elements with the ID "div1", with the second appended as a child node of the first. Effectively resulting in the following HTML: <div align="center" id="div1"> some content i want to show twice <div align="center" id="div1">some content i want to show twice</div> </div> Quote Link to comment https://forums.phpfreaks.com/topic/219352-javascript-div-inline/#findComment-1138332 Share on other sites More sharing options...
logicslab Posted November 23, 2010 Share Posted November 23, 2010 Hi Adam, U are Absolutely Right, like You I don't Get the Actual Requirement of our Kimmie .... Regards Anes P.A Quote Link to comment https://forums.phpfreaks.com/topic/219352-javascript-div-inline/#findComment-1138373 Share on other sites More sharing options...
kimmieblob Posted November 24, 2010 Author Share Posted November 24, 2010 sorry guys i was gone for a bit, ill set up a demo site so you can get a better example thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/219352-javascript-div-inline/#findComment-1138858 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.