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;

Edited by triumphost: n/a

5 Years
Discussion Span
Last Post by stbuchok

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.