I am writing an application using prototype.js and dialog.2.0.js
(http://roland.devarea.nl/dialog/#e6) the iframe effect. But I
encountered a problem when I try to fitting it into my application.
What I want to do is that when a user click <a href="#"
id="dialog_1">Show Iframe</a> , a dialog box will be shown. Thus, I
use the following code,
//showiframe.js
var modal = new Dialog({
handle: '#dialog_1',
title: 'Google.com',
width: 'max',
height: 'max',
padding:0,
margin: 75,
iframe:'http://www.google.com'
});
$('dialog_1').observe('click',function(){
modal.open();
});
then in my page, i have,
<head>
<script type="text/javascript"src="javascript/prototype.js"></script>
<script type="text/javascript"src="javascript/scriptaculous.js?
load=effects,controls"></script>
<script type="text/javascript" src="js/dialog.2.0.js"></script>
<script type="text/javascript" src="js/showiframe.js"></script>
</head>
......
<ul id="menu">
<li><a class="current" href="index.php" title="Welcome">Home</
a></li>
<li><a href="crblog.php" title="Create post">Create post</a></
li>
<li><a href="#" id="dialog_1">View iframe</a></li>
</ul>
..............
but it is no effect and firebug shows that $("dialog_1") is null.
However, if I strictly follow the dialog.2.0 's sample, that is :
<li><a href="javascript:," id="dailog_1">View iframe</a></li>
.............
and embeding the javascript in the main page,
<script type="text/javascript" language="javascript">
new Dialog({
handle:'#dialog_12',
title:'Dialog #12 (Google.com)',
width:'max',
height:'max',
padding:0,
margin:75,
iframe:'http://www.google.com'
});
</script>
It works fine. Does anyone know how can I implement it in an
unobtrusive way? Any help would be appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---