Webforumz's RSS FeedRSS Webforumz RegistrationRegister Contact Webforumz StaffContact

dhtml scroller script help please!!

This is a discussion on "dhtml scroller script help please!!" within the JavaScript Forum section. This forum, and the thread "dhtml scroller script help please!! are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Apr 8th, 2004, 16:50
New Member
Join Date: Apr 2004
Location: United Kingdom
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
dhtml scroller script help please!!

Dear all

This script works fine with and without the PHP part.
The bit that is causing it grief is the "onclick=" in the php.
If I use no onclick the page comes up in the new window fine.
As soon as I add the additional parms the script fails (the php works great on it's own!!)

My question is, how can I alter this dhtml in order to be able to control the size of the popup with my onclick command?

<div id="tester" style="position:relative; top:-35; left:-5">
<script language="JavaScript1.2">

/*
Scrollable Menu Links- By Dynamicdrive.com
For full source, TOS, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/

//configure path for left and right arrows
var goleftimage='img/arrow_left.gif'
var gorightimage='img/arrow_right.gif'
//configure menu width
var menuwidth=439
//configure menu height
var menuheight=110
//configure scroll speed (1-10), where larger is faster
var scrollspeed=6
//specify menu content
var menucontents='<?php
include '/home/shoebiz/include/db.php';
$qResult = mysql_query ("SELECT * FROM shoe_tab WHERE style='Lowcut' AND instock='1'");
$nRows = mysql_num_rows($qResult);
for ($i=0; $i< $nRows; $i++){
$row = mysql_fetch_array($qResult);
$path = $row["path];
$small_image = $row["small_image];
echo "<a href=\"$path\" onClick=\"window.open('$path', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width=300, height=400, screenX=300,screenY=120,left=300,top=120'); return false\"><img src=\"$small_image\"></a>";
}
?>
'

////NO NEED TO EDIT BELOW THIS LINE////////////

var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+menucontents+'</span>')
var actualwidth=''
var cross_scroll, ns_scroll
var loadedyes=0
function fillup(){
if (iedom){
cross_scroll=document.getElementById? document.getElementById("test2") : document.all.test2
cross_scroll.innerHTML=menucontents
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
}
else if (document.layers){
ns_scroll=document.ns_scrollmenu.document.ns_scrol lmenu2
ns_scroll.document.write(menucontents)
ns_scroll.document.close()
actualwidth=ns_scroll.document.width
}
loadedyes=1
}
window.onload=fillup

function moveleft(){
if (loadedyes){
if (iedom&&parseInt(cross_scroll.style.left)>(menuwid th-actualwidth)){
cross_scroll.style.left=parseInt(cross_scroll.styl e.left)-scrollspeed
}
else if (document.layers&&ns_scroll.left>(menuwidth-actualwidth))
ns_scroll.left-=scrollspeed
}
lefttime=setTimeout("moveleft()",50)
}

function moveright(){
if (loadedyes){
if (iedom&&parseInt(cross_scroll.style.left)<0)
cross_scroll.style.left=parseInt(cross_scroll.styl e.left)+scrollspeed
else if (document.layers&&ns_scroll.left<0)
ns_scroll.left+=scrollspeed
}
righttime=setTimeout("moveright()",50)
}

if (iedom||document.layers){
with (document){
write('<table border="0" cellspacing="0" cellpadding="0">')
write('<td valign="middle"><a href=#" onMouseover="moveleft()" onMouseout="clearTimeout(lefttime)">[img]'+goleftimage+'[/img]</a> </td>')
write('<td valign="top">')
if (iedom){
write('<div style="position:relative;width:'+menuwidth+';">')
write('<div style="position:absolute;width:'+menuwidth+';heigh t:'+menuheight+';overflow:hidden;">')
write('<div id="test2" style="position:absolute;left:0;top:0">')
write('</div></div></div>')
}
else if (document.layers){
write('<ilayer width='+menuwidth+' height='+menuheight+' name="ns_scrollmenu">')
write('<layer name="ns_scrollmenu2" left=0 top=0></layer></ilayer>')
}
write('</td>')
write('<td valign="middle"> <a href="#" onMouseover="moveright()" onMouseout="clearTimeout(righttime)">')
write('[img]'+gorightimage+'[/img]</a>')
write('</td></table>')
}
}
</script>
</div>

mucho thankage.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #2  
Old Apr 8th, 2004, 17:07
Up'n'Coming Member
Join Date: Oct 2003
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Perhaps you could try this for your PHP

Code: Select all
<?php
include '/home/shoebiz/include/db.php';
$qResult = mysql_query ("SELECT * FROM shoe_tab WHERE style='Lowcut' AND instock='1'");
$nRows = mysql_num_rows($qResult);
for ($i=0; $i< $nRows; $i++){
$row = mysql_fetch_array($qResult);
$path = $row["path];
$small_image = $row["small_image];
echo "<a href=\"$path\" onClick=\"window.open('".$path."', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width=300, height=400, screenX=300,screenY=120,left=300,top=120'); return false\"><img src=\"$small_image\"></a>";
}
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Apr 8th, 2004, 17:31
New Member
Join Date: Apr 2004
Location: United Kingdom
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
I am afraid this made no difference.
My PHP works well when it is not in this script.
My feeling is that I will need to create an action within the dhtml portion.
Being a newb I can't tell where the new window is called from, the menucontent variable does not make it clear to me where to add the onclick java piece.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Apr 13th, 2004, 09:48
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Maybe your PHP is inserting something strange into the string which stops your onClick from working. View the source and post that here.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Apr 13th, 2004, 12:31
Highly Reputable Member
Join Date: Aug 2003
Location: Australia
Posts: 662
Thanks: 0
Thanked 0 Times in 0 Posts
Might be worth it to save your php in a seperate file and then just call it up and use it that way... I know with ASP coding you have to do that quite frequently.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
dhtml, scroller, script, help

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
DHTML script problem! Bruni Web Page Design 6 Feb 28th, 2007 13:09
scroller issue.. please help.. Perfection Studios Flash & Multimedia Forum 10 Oct 1st, 2006 05:18
News Scroller sobiaa JavaScript Forum 1 Dec 1st, 2005 12:59
Javacript Scroller (NOT DHTML) therussian JavaScript Forum 18 Sep 28th, 2003 08:16
DHTML news scroller Rob JavaScript Forum 7 Aug 21st, 2003 17:02


All times are GMT. The time now is 20:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8