Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

project help

Featured Replies

how i can disply the video on div #video by dynamic linking in navigation menu

the video store in database

 

 <?php
while($row =mysql_fetch_row($query))
{
	$titile =$row[2];
	$ids= $row[1];


	?>

       <p> <a href="index.php?id.=<?php echo $ids ;?>".><? print "$titile<br>"?> </a></p>

<?	}



?>
 </div>

post-35093-0-50451100-1323263670_thumb.png

post-35093-0-05687400-1323263748_thumb.png

The secret is to swap the innerHTML of the div that will be holding the video, this can be done using a full page reload passing the output of the navigation button as a get request or you can use javascript with a little Ajax that will change the contents without refreshing the entire page.

 

Basic Demo: http://lovelogic.net/z_tuts/ajax1.php

 

 

Video Page:

<head>

<title>Ajax div swapper</title>

<script type="text/javascript">
function loadXMLDoc(target)
{
var xmlhttp;
if (window.XMLHttpRequest)
 {// code for IE7+, Firefox, Chrome, Opera, Safari
 xmlhttp=new XMLHttpRequest();
 }
else
 {// code for IE6, IE5
 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 }
xmlhttp.onreadystatechange=function()
 {
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
   {
   document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
   }
 }
xmlhttp.open("GET","fetch_video.php?target="+target,true);
xmlhttp.send();
}
</script>

</head>

<body>



<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc(1)">First item</button>
<button type="button" onclick="loadXMLDoc(2)">Second item</button>

</body>
</html>

 

fetch_video.php

<?php
//// basic video swap without SQL

$target = ($_GET["target"]);

if ($target==1) $output='<iframe width="420" height="315" src="http://www.youtube.com/embed/TsevuRJz6pc" frameborder="0" allowfullscreen></iframe>' ;

if ($target==2) $output='<iframe width="420" height="315" src="http://www.youtube.com/embed/b5mVELsbM_M" frameborder="0" allowfullscreen></iframe>' ;

echo '<h1>'.$output.'</h1>';
?>


  • Author

thank u

can u make the code with php and html code

becouse i cant understand ajax code

Edited by ehsan_cs

demo.php

<?php
//// basic video swap without SQL
//// and no javascript

$target = ($_GET["target"]);

if ($target==1) $output='<iframe width="560" height="315" src="http://www.youtube.com/embed/DWCfRezQsWE" frameborder="0" allowfullscreen></iframe>' ;

if ($target==2) $output='<iframe width="560" height="315" src="http://www.youtube.com/embed/H52DISr_OUg" frameborder="0" allowfullscreen></iframe>' ;

if (!$target) $output = '<iframe width="560" height="315" src="http://www.youtube.com/embed/b5mVELsbM_M" frameborder="0" allowfullscreen></iframe> '; // if no target value set -> shows this
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ehsan_cs - homework help</title>
</head>

<body>

<?php
echo $output;
?>

<p><a href="demo.php?target=1">video one</a></p>
<p><a href="demo.php?target=2">video two </a></p>
</body>
</html>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.