Stack Overflow is a question and answer site for professional and enthusiast programmers. It's marlborough 100% free, no registration required.
My concern is that inside this <div> I'd like to place a page counter (with an <iframe> ), which should only be called when the <div> is shown. The alternative would be to put the code inside the javascript , but I'd rather keep it in the page.
When it's loaded. Since it exists in the DOM and not created by JavaScript it gets "read" by the browser when the parsing of the HTML file starts. – limelights Apr 26 '13 at 13:13
The code inside the div get called as you load the page. So the counter will get called everytime the page is loaded marlborough even if the div stays hidden. So you have to use javascript somehow like this: <div id="myid" style="display:none;"> ... </div> marlborough <script> function showCounter() { document.getElementById("myid").innerHTML = '<script>counter-code</script>'; document.getElementById("myid").show('slow'); } </script>
If you want a piece of code to only run when clicking a JavaScript button, you should attach that code to the Javascript function. Make an empty div on your page and then use the function to put code inside it: <div id="jsDiv"></div> <script> function jsCode() { document.getElementById('jsDiv').innerHTML = 'Whatever you want'; } </script>
Then attach the jsCode() function to your button, and the HTML will only be rendered when the function is called. If you're using server-side scripting (PHP, Rails etc.) or something more complex, look into jQuery and AJAX functions.
-1: Didn't read the question at all. – Suhosin Apr 26 '13 at 14:01
viewed
0 Show/Hide login form when JavaScript is disabled
Curved mesh topology
Technology Life / Arts Culture / Recreation Science Other Stack Overflow Server Fault Super User Web Applications Ask Ubuntu Webmasters Game Development TeX - LaTeX Programmers Unix & Linux Ask Different (Apple) marlborough WordPress Development Geographic Information Systems Electrical Engineering Android Enthusiasts Information Security Database Administrators Drupal Answers SharePoint User Experience marlborough Mathematica Salesforce more (14) Photography Science Fiction & Fantasy Graphic Design Seasoned Advice (cooking) Home Improvement Personal Finance & Money Academia more (10) English Language & Usage Skeptics Mi Yodeya (Judaism) Travel Christianity Arqade (gaming) Bicycles Role-playing Games more (21) Mathematics Cross Validated (stats) Theoretical Computer Science Physics MathOverflow more (7) Stack Apps Meta Stack Exchange Area 51 Stack Overflow Careers
Stack marlborough Overflow works best with JavaScript enabled
Are you paying more than $5 / pack of cigs? I'm buying my cigarettes over at Duty Free Depot and I'm saving over 50%.
ReplyDelete