I have a page that has a hidden button at the top. When a link is clicked, the button shows. I want to write javascript so that if the button is showing, add a breakline below it and if it is not showing, do nothing. My attempt & fail is below. Can someone shed some light?

<input type="button" id="listframes" value="Button" />		

<script type="text/javascript">
	//If the button is showing, then break line below it.. else do nothing
	var ButtonID = document.getElementById('listframes');

	if(ButtonID.style.display == 'block')
		 document.writeln('<br /> \r\n');

<iframe id="external_frame" name="ExternalFrame" frameborder="0" scrolling="auto" marginwidth="0" marginheight="0"></iframe>
#listframes {
    display: none;
Member Avatar

Put the button in a div or span (or other element) and show and hide that element. You can place a break line after the button inside the other element.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.