Bonjour
Voulant créer un damier intéractif j'utilise en javascript ceci :
// global variable holding the machine window
var program_window;
function openShockwave(name, filename, width, height, stretch) {
var url = 'shockwave.php?name=' + name + '&filename=' + filename + '&stretch=' + stretch + '&width=' + width + '&height=' + height + '';
var x = randomX(width);
var y = randomY(height);
var stretch_yes_or_no;
if (stretch) {
stretch_yes_or_no = 'yes';
height += 18;
} else {
stretch_yes_or_no = 'no';
}
features = 'width=' + width + ', height=' + height + ', location=no, menubar=no, scrollbars=no, resizable=' + stretch_yes_or_no + ', status=' + stretch_yes_or_no + ', toolbar=no, top=' + x + ', left=' + y + ', screenX=' + x + ', screenY=' + y + '';
// if the window is already open, close it (easier to control window size)
if (program_window != null) {
// make sure the user hasn't already closed it himself (in which case the following lines wouldn't run!)
if (program_window.closed == false) program_window.close();
}
// open up a new window with the features we want
program_window = window.open(url, 'machine', features);
}
function openProcessing(name, filename, width, height) {
var url = 'processing.php?name=' + name + '&filename=' + filename + '&width=' + width + '&height=' + height + '';
var x = randomX(width);
var y = randomY(height);
features = 'width=' + width + ', height=' + height + ', location=no, menubar=no, scrollbars=no, resizable=no, status=no, toolbar=no, top=' + x + ', left=' + y + ', screenX=' + x + ', screenY=' + y + '';
// if the window is already open, close it (easier to control window size)
if (program_window != null) {
// make sure the user hasn't already closed it himself (in which case the following lines wouldn't run!)
if (program_window.closed == false) program_window.close();
}
// open up a new window with the features we want
program_window = window.open(url, 'machine', features);
}
function openLink( url, width, height, scrollbars ) {
var x = randomX(width);
var y = randomY(height);
if (scrollbars) {
scrollbars = 'yes';
} else {
scrollbars = 'no';
}
var features = 'width=' + width + ', height=' + height + ', location=no, menubar=no, scrollbars=' + scrollbars + ', resizable=yes, toolbar=no, top=' + x + ', left=' + y + ', screenX=' + x + ', screenY=' + y + '';
// if the window is already open, close it (easier to control window size)
if (program_window != null) {
// make sure the user hasn't already closed it himself (in which case the following lines wouldn't run!)
if (program_window.closed == false) program_window.close();
}
// open up a new window with the features we want
program_window = window.open(url, 'machine', features);
}
function randomX(width) {
var offset = 20, screenW = screen.availWidth;
return ( Math.round( Math.random() * (screenW - (width+offset) ) ) );
}
function randomY(height) {
var offset = 20, screenH = screen.availHeight;
return( Math.round( Math.random() * (screenH - (height+offset) ) ) );
}
Mais j'aimerais ainsi lier chaque case du damier à un lien hypertexte et donc au survol d'une case on voit un picto correspondant à la rubrique et si l'on clique on tombe sur l'article concerné contenant la photo qui figurait sur ce damier, comment faire un script php ou autre pour permettre cela en html cela ressemble à ceci:
<div id="random">
<table id="random_table">
<tr>
<td class="random_blog_local"><a class="random_blog_local" href="http://olivierbaudrydesign.free.fr/?page_id=21"><img src="http://olivierbaudrydesign.free.fr/?page_id=21/crop.php?width=120&url=http://olivierbaudrydesign.free.fr/?page_id=21/thumbnails/book_jouable.jpg" alt="Livre Jouable" /></a></td>
Comment faire en sorte de lier le script javascript au php ?
Olivier Baudry
multimedia *
maxmsp developpement
sound design and visual arts and design
olivierbaudry.eba at hotmail dot fr