begin process at 2008 08 28 22:09:59
1 233 395 membres
487 nouveaux aujourd'hui
14 291 membres club

Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : damier intéractif et fonction random en javascript avec recherche d'url en php? [ CSS / Général ] (baudryolivier)

damier intéractif et fonction random en javascript avec recherche d'url en php? le 15/05/2008 02:15:37

baudryolivier
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"><!-- start contents -->
<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&amp;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


Classé sous : var, window, width, program, height

Participer à cet échange

Pub



Appels d'offres

Recherche developpeur ...
Budget : 700€
SITE MARCHAND LOCATION...
Budget : 3 000€
SITE MARCHAND POUR HOTEL
Budget : 4 000€

Snippets en rapport

CalendriCode

Août 2008
LMMJVSD
    123
45678910
11121314151617
18192021222324
25262728293031

Boutique

Boutique de goodies CodeS-SourceS