This post has been edited 1 times, last edit by "Fragz" (Jan 29th 2011, 9:51am)
|
|
HTML Code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>jquery dialog - jsFiddle demo by TorbenBrodt</title> <script type='text/javascript' src='http://code.jquery.com/jquery-1.4.4.min.js'></script> <link rel="stylesheet" type="text/css" href="/css/normalize.css"> <link rel="stylesheet" type="text/css" href="/css/result-light.css"> <style type='text/css'> </style> <script type='text/javascript'> //<![CDATA[ $(window).load(function(){ $( "#dialog" ).dialog(); }); //]]> </script> </head> <body> <!DOCTYPE html> <html lang="en"> <base href="http://jqueryui.com/"/> <head> <meta charset="utf-8"> <title>jQuery UI Dialog - Default functionality</title> <link rel="stylesheet" href="themes/base/jquery.ui.all.css"> <script src="external/jquery.bgiframe-2.1.2.js"></script> <script src="ui/jquery.ui.core.js"></script> <script src="ui/jquery.ui.widget.js"></script> <script src="ui/jquery.ui.mouse.js"></script> <script src="ui/jquery.ui.draggable.js"></script> <script src="ui/jquery.ui.position.js"></script> <script src="ui/jquery.ui.resizable.js"></script> <script src="ui/jquery.ui.dialog.js"></script> </head> <body> <div id="dialog" title="Basic dialog"> <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p> </div> </body> </html> </body> </html> |
|
|
JavaScript Code |
1 2 3 |
$(document).load(function(){ showDialog(...) }); |
|
|
PHP Quellcode |
1 2 3 4 |
if ($f !== 2 ) { hier sollte die funktion aufgerufen werden } |
|
|
JavaScript Code |
1 2 3 |
$(document).load(function(){ showDialog('Success','Your request has been successfully received.','success') }); |
|
|
PHP Quellcode |
1 2 3 4 5 6 |
if ($f !== 2 ) { echo "$(document).load(function(){ showDialog('Success','Your request has been successfully received.','success') });"; } |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
{if $RULES != ''}
<div class="forum_rules">
<h2>{$LANG.forum_rules_set}</h2>
<br />
{if $IS_RULES_LINK}
{$LANG.forum_rules_text}
<br /><br />
<a href="topic.{$EXT}?t={$RULES}" target="_blank">{$LANG.forum_rules_click}</a>
{else}
{$RULES}
{/if}
</div>
{/if}
|
|
|
Source code |
1 2 3 4 5 6 |
{if $RULES != ''}
<script language="JavaScript" type="text/javascript">
showDialog('{$LANG.forum_rules_set}','{$RULES}','success')
</script>
{/if}
|
This post has been edited 1 times, last edit by "Fragz" (Jan 31st 2011, 9:28pm)
|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 |
<?php $data = 'Test Test'; $json = json_encode($data); ?> <script type="text/javascript"> // JavaScript Datenerhebung var json = '<?= $json ?>'; |
|
|
JavaScript Code |
1 2 3 |
dialogtitle.innerHTML = title; dialogcontent.className = type; dialogcontent.innerHTML = message; |
|
|
JavaScript Code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
// build/show the dialog box, populate the data and call the fadeDialog function // function showDialog(title,message,type,autohide) { if(!type) { type = 'error'; } var dialog; var dialogheader; var dialogclose; var dialogtitle; var dialogcontent; var dialogmask; if(!document.getElementById('dialog')) { dialog = document.createElement('div'); dialog.id = 'dialog'; dialogheader = document.createElement('div'); dialogheader.id = 'dialog-header'; dialogtitle = document.createElement('div'); dialogtitle.id = 'dialog-title'; dialogclose = document.createElement('div'); dialogclose.id = 'dialog-close' dialogcontent = document.createElement('div'); dialogcontent.id = 'dialog-content'; dialogmask = document.createElement('div'); dialogmask.id = 'dialog-mask'; document.body.appendChild(dialogmask); document.body.appendChild(dialog); dialog.appendChild(dialogheader); dialogheader.appendChild(dialogtitle); dialogheader.appendChild(dialogclose); dialog.appendChild(dialogcontent);; dialogclose.setAttribute('onclick','hideDialog()'); dialogclose.onclick = hideDialog; } else { dialog = document.getElementById('dialog'); dialogheader = document.getElementById('dialog-header'); dialogtitle = document.getElementById('dialog-title'); dialogclose = document.getElementById('dialog-close'); dialogcontent = document.getElementById('dialog-content'); dialogmask = document.getElementById('dialog-mask'); dialogmask.style.visibility = "visible"; dialog.style.visibility = "visible"; } dialog.style.opacity = .00; dialog.style.filter = 'alpha(opacity=0)'; dialog.alpha = 0; var width = pageWidth(); var height = pageHeight(); var left = leftPosition(); var top = topPosition(); var dialogwidth = dialog.offsetWidth; var dialogheight = dialog.offsetHeight; var topposition = top + (height / 3) - (dialogheight / 2); var leftposition = left + (width / 2) - (dialogwidth / 2); dialog.style.top = topposition + "px"; dialog.style.left = leftposition + "px"; dialogheader.className = type + "header"; dialogtitle.innerHTML = title; dialogcontent.className = type; dialogcontent.innerHTML = message; var content = document.getElementById(WRAPPER); dialogmask.style.height = content.offsetHeight + 'px'; dialog.timer = setInterval("fadeDialog(1)", TIMER); if(autohide) { dialogclose.style.visibility = "hidden"; window.setTimeout("hideDialog()", (autohide * 1000)); } else { dialogclose.style.visibility = "visible"; } } |