Membership is FREE, giving all registered users unlimited access to every DNForum feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Need Code Help

moreuplink

Level 4
Legacy Platinum Member
Joined
Jan 20, 2013
Messages
170
Reaction score
5
i have a click pop up and have two links. If i click on first link, it should show first image and if i click on the second link then it should bring up second image but my code is not doing it. here is the code and help will appreciated. I need to create a loop.
==============================
<script type="text/javascript">
jQuery(document).ready(function(){
if (document.cookie.indexOf('visited=true') == 1) {
var fifteenDays = 1000;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
$.colorbox({width:"auto", inline:true, href:"#subscribe"});
}

$(".open_popup").colorbox({width:"730px", inline:true, href:"#subscribe"});

});
</script>
</head>
<body>
<?php
$a=1;
while($a<=2){
?>
<a href="#" class="open_popup"><?php echo $a++ ?>Click here to open the popup</a>
<br />
<?php } ?>

<div style="display: none;">
<!-- Start Subcribe Box -->
<div id='subscribe' style='padding: 9px; background:#ffffff;'>
<h2 class="offerTitle">i want to show here id 1 & when i click on Second Link,should show id 2...How i can set Loop Value here??? </h2>
<div class="clear"></div>
<!-- Start Pop up Box -->
<div id="offerContainer">
<!-- Start offer -->
<div class="picBoxContainer">
<img src="1.jpg" />
</div>
<!-- End offer -->
</div>
<!-- End Popup Box -->
</div>
<!-- End Subcribe Box -->
</div>
 

KaneMilles

New Member
Legacy Gold Member
Joined
Oct 30, 2015
Messages
1
Reaction score
0
<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Can Change Images</h1>

<imgid="myImage"onclick="changeImage()"src="img/0.jpg"width="180"height="180">
<table>
<tr>
<td><ahref="#"id="1"onclick="changeImage()"> Image1</a></td>

</tr>
<tr>
<td><ahref="#"id="2"onclick="changeImage()"> Image2</a></td>

</tr>
<tr>
<td><ahref="#"id="3"onclick="changeImage()"> Image3</a></td>

</tr>
</table>



please improve this code. If we click on image 2 link . image link 2 no work.i also use more then 2 images in this code.
Thanks advance.

</body>
</html>
 

Who has viewed this thread (Total: 1) View details

Who has watched this thread (Total: 3) View details

Top Bottom