Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey I am trying to create a popup box. this is the best I can so at the moment because time is running out on me here.

this popup box was supposed to have a tick and a show button when it is initialize, like when u go on the page that it is. it is supposed to pop up as the name say but it like it is frozen on one spot.

I dont what in the code that I have put wrong.

here is what i have adn what i have tried so far

What I have tried:

<html lang="en" dir="ltr">	
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" href="../css/stylesheet.css"/>
		
	</head>
	<body>
		<div class="show_box">
			<a class="btn">show Box</a>
			<div id="box">
				<span class="ion-checkmark-round"></span>
				
				<h1>"Hi Welcome!!!!!! Luana Taylor, you are now are member of Caribbean Nature Seekers InstituteTT ('CNSITT')");</h1>
				
				<a class="close">Close</a>
				
			</div>
		
			<script  type="text/javascript">
			 var c=0'
		 
			 function pop()
			 {
				 if(c == 0)
				 {
					 document.getElementById("box").style.display = "block";
					 c ==1;
					 
				 }
				 else
				 {
					 document.getElementById("box").style.display = "none";
					 c ==1;
				 }
			 }
		</div>
	</body>
</html>

		<div id="contentArea">
			
			
			<div id="footerbox">
				
					<div id="footerholder">
						<div id="">
						
							<a href="../index.php">Homepage</a>
							<a href="popupbox.php">Popup box </a>
							<a href="featureNationalWonders.php">Feature National Wonders</a>			
						
						</div>
Posted
Updated 26-Mar-19 0:50am
Comments
Mohibur Rashid 25-Mar-19 22:27pm    
How do expect your popup box to look like?

Does popup as standard window style? or does this popped up as separate tab or does this pop up inside your browser document.

May be build a clear concept and learn the topic better.
Richard Deeming 26-Mar-19 15:39pm    
There doesn't seem to be anything in the code you've posted that would call your pop function.
divinity02 27-Mar-19 6:36am    
@richard deeming, how do you call a popup, pray please do tell
Richard Deeming 27-Mar-19 8:32am    
Assuming you want it to display immediately:
<script>
var isPopupVisible = false;

function pop(){
    if (isPopupVisible) {
        document.getElementById("box").style.display = "none";
        isPopupVisible = false;
    }
    else {
        document.getElementById("box").style.display = "block";
        isPopupVisible = true;
    }
}

// Call the function immediately to show the popup:
pop();
</script>

You'll also want to make the "close" button work:
<a class="close" onclick="pop();return false;">Close</a>
Richard Deeming 27-Mar-19 11:34am    
Did you add onclick="pop();return false;" to your close button?

1 solution

teh very first line in your javascript is var c='. I think you meant to put var c=0;.

I don't know if this is your problem, but fix it and see.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900