All,

I'm trying to call in my first dyanmic JavaScript function OpenDynamicPic the BreedVideoOpen(videopath) function so that the dynakic image appears on the left and a video appear on the right - however I seem to be getting the BreedVideoOpen functions output keeps appearing in the top left of my webpage - therefore what needs to be done so this function can be called inside the first function so that the image appears n the right and the video on the left:

function OpenDynanamicPic(filedesc,filepath) {

var winContent = "<B style='font-size:18px;font-family:Verdana,sans-serif;line-height:1.5'>" + filedesc + "</B>";
winContent += "<CENTER>"; 
winContent += "<table border='0'><tr><td colspan='2'>";
winContent += "<img src='dynamic_imgs/" + filepath + "' name='" + filepath + "'><br>"; 
winContent += "</td>";
winContent += "<td>";
BreedVideoOpen(videopath);
winContent += "</td>";
winContent += "</tr></table>";
winContent += "<a href='/shoppingCart/addToCart.cgi?item=pc&design=" + filepath + "&description=" + filepath + "&quantity=1&price=40'><img src='/images/buy.gif' border='0'></a><br><br>";
winContent += "<a href='product1.htm' style='text-decoration : none;'><b>Product 1</b></a>  <a href='product2.htm' style='text-decoration : none;'><b>Product 2</b></a>  <a href='products.htm' style='text-decoration : none;'><b>Products Full</b></a>  <a href='link1.htm' style='text-decoration : none;'><b>Link 1</b></a>  <a href='index.htm' style='text-decoration : none;'><b>HOME</b></a>  "
winContent += "</CENTER>";
document.write(winContent);

} 

function BreedVideoOpen(videopath) {

var winContent = "";

if(videopath && videopath.length>0) {

winContent +="<p><a href='#' id='dialog_link' class='ui-state-default ui-corner-all'><span class='ui-icon ui-icon-newwin'></span>Video Sample</a></p>"
winContent +="<div id='dialog' title='Video Sample'>"
winContent +="<p align='center'><OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width='190' height='480' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>"
winContent +="<param name='src' value='" + videopath + "'>"
winContent +="<param name='autoplay' value='true'>"
winContent +="<param name='controller' value='true'>"
winContent +="<param name='loop' value='true'>"
winContent +="<EMBED src='+ videopath +' autoplay='true' controller='true' loop='true' width='190' height='480' pluginspage='http://www.apple.com/quicktime/download/'>"
winContent +="</EMBED>"
winContent +="</OBJECT></p>"
winContent +="</div>"

document.write(winContent);
}

} 

Recommended Answers

All 2 Replies

Errr... You are using old and some even deprecated way of HTML scripting... Also, you are using document.write() which is to rewrite the whole page with the content you specify...

What you should do is to have an area of display in place in the page for each content you want to display. Then in your JavaScript, you edit the content of the element instead of edit the whole page (using document.write()).

I am not sure how much knowledge you have in JavaScript...

According to my knowledge Your are using document.write() twice dont do like that just append the content of BreedVideoOpen to the wincontent and display it once at the end of OpenDynanamicPic function it will solve your problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.