A good place to start here would be to wrap your DOM elements in $(),
so it would look like this:
var htmlW = $('<div id="'+windowId+'" class="window"><div
class="windowTop"><div class="windowTopContent">Window example</
div><img src="images/window_min.jpg" class="windowMin" /><img
src="images/window_max.jpg" class="windowMax" /><img src="images/
window_close.jpg" class="windowClose" /></div><div
class="windowBottom"><div class="windowBottomContent"> </div></
div><div class="windowContent"><p>bla 1</p><p>bla 2</p><p>bla 3</p></
div><img src="images/window_resize.gif" class="windowResize" /></div>');
then call your createWindow function within document.ready:
$(document).ready(createWindow);
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Jun 4, 2007, at 12:34 PM, radzio wrote:
Hi!
I'm making js script which allows to create div floating windows. I
want to use jQuery + interface but I met with difficulties. I create
html code with js:
function createWindow()
{
var windowId = '#test';
var htmlW = '<div id="'+windowId+'" class="window"><div
class="windowTop"><div class="windowTopContent">Window example</
div><img src="images/window_min.jpg" class="windowMin" /><img
src="images/window_max.jpg" class="windowMax" /><img src="images/
window_close.jpg" class="windowClose" /></div><div
class="windowBottom"><div class="windowBottomContent"> </div></
div><div class="windowContent"><p>bla 1</p><p>bla 2</p><p>bla 3</p></
div><img src="images/window_resize.gif" class="windowResize" /></
div>';
$(htmlW).appendTo("body");
if($(windowId).css('display') == 'none') {
$(windowId).DropInRight(1000);
}
}
Unfortunately it doesn't work ;/ I read about $(document).ready
(http://docs.jquery.com/Tutorials:Introducing_%24%28document%29.ready
%28%29) and ... Is there any chance to generate html code in js then
append it to body and add effects etc. to it?