Navigation buttons.

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
svankamon
-


Joined: 01 Apr 2007
Posts: 148
Location: Chesterfield UK

PostPosted: Fri Sep 21, 2007 10:04 pm    Post subject: Navigation buttons. Reply with quote

Im trying to insert the code below into a php script. However it wont work as it keeps comin up with errors. The code is from a set of nav buttons i created with web buttons maker. I cant get it to work as syntax errors, T_String and other errors keep coming up when i attempt to change the code. Im not a programmer but keep trying to get it to work anywhay. Wont. Any ideas anyone. Cheers.

Oh its fpr 4 buttons going acros top of page and want image to change on mouseover.

<html>
<head>
</head>
<body bgcolor="#FFFFFF">
<div align="center">

<!-- Begin of MTop web button menu code -->
<script type="text/javascript" language="JavaScript1.2">
<!--
var btnCount = 4;
var staCount = 3;
var btnImages = new Array();
for (i= 0; i< btnCount; i++)
{
btnImages[i] = new Array();
for (j= 0; j< staCount; j++)
{
btnImages[i][j] = new Image();
btnImages[i][j].src = './mbtn' + i + '_' + j + '.gif';
}
}
function btnMouseOut(img)
{
document.images[img].src = btnImages[img.substring(img.indexOf('mbtn')+4,img.length)][0].src;
};
function btnMouseOver(img)
{
document.images[img].src = btnImages[img.substring(img.indexOf('mbtn')+4,img.length)][1].src;
};
function btnMouseDown(img)
{
document.images[img].src = btnImages[img.substring(img.indexOf('mbtn')+4,img.length)][2].src;
};
//-->
</script>
<table id="mbtn_tb" cellpadding=0 cellspacing=0 border=0>
<tr>
<td style="padding-right:0px" id="mbtn_td0">
<a onMouseOver="btnMouseOver('mbtn0')" onMouseOut="btnMouseOut('mbtn0')" onMouseDown="btnMouseDown('mbtn0')" href="http://cartouche.org.uk/classifieds/freeuk">
<img src="./mbtn0_0.gif" name=mbtn0 border=0 width="219" height="26" alt ="Button1"></a></td>
<td style="padding-right:0px" id="mbtn_td1">
<a onMouseOver="btnMouseOver('mbtn1')" onMouseOut="btnMouseOut('mbtn1')" onMouseDown="btnMouseDown('mbtn1')" href="http://cartouche.org.uk/classifieds/freeglobal">
<img src="./mbtn1_0.gif" name=mbtn1 border=0 width="219" height="26" alt ="Button2"></a></td>
<td style="padding-right:0px" id="mbtn_td2">
<a onMouseOver="btnMouseOver('mbtn2')" onMouseOut="btnMouseOut('mbtn2')" onMouseDown="btnMouseDown('mbtn2')" href="http://cartouche.org.uk/classifieds/national">
<img src="./mbtn2_0.gif" name=mbtn2 border=0 width="219" height="26" alt ="Button3"></a></td>
<td style="padding-right:0px" id="mbtn_td3">
<a onMouseOver="btnMouseOver('mbtn3')" onMouseOut="btnMouseOut('mbtn3')" onMouseDown="btnMouseDown('mbtn3')" href="http://cartouche.org.uk/classifieds/global">
<img src="./mbtn3_0.gif" name=mbtn3 border=0 width="219" height="26" alt ="Button4"></a></td>
</tr>
</table>
<noscript>To display this page, you need to have JavaScript enabled. For more details, please visit <a href=http://www.mtopsoft.com/web-button-maker/index.htm>Web Button Menu Maker</a></noscript>
<!-- End of MTop web button menu code -->


<div>
</body>
</html>
Back to top View user's profile Send private message Send e-mail
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Fri Sep 21, 2007 10:37 pm    Post subject: Reply with quote

The only way you could get errors is if you have that code enclosed in some quotes and you are outputting it with PHP. Is that what you're doing? If so then you'll need to escape the quotes with backslashes.
_________________
-Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados.
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
pkSML
-


Joined: 29 May 2006
Posts: 952
Location: Michigan, USA

PostPosted: Sat Sep 22, 2007 2:27 am    Post subject: Reply with quote

Why not make the Javascript an external file?

This can be done two ways.
1. In the HTML output of the script (i.e. not in PHP code), make an external reference to the JS file.
2. Include the JS file using PHP's include() function.

Either way should clear up your problem.
_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
svankamon
-


Joined: 01 Apr 2007
Posts: 148
Location: Chesterfield UK

PostPosted: Sat Sep 22, 2007 12:23 pm    Post subject: Thanks for responce Reply with quote

Im not a php expert although im learning as i go. Not sure about the include reference but will give it a go. There is a shorter version of the code which "Incleds" a reference to the js script but that gave errors too. Il try again then post my results here, ie what and were i place things etc. Thanks a lot id really like to get these buttons up and working. Cheers again. Good luck.
Back to top View user's profile Send private message Send e-mail
svankamon
-


Joined: 01 Apr 2007
Posts: 148
Location: Chesterfield UK

PostPosted: Sat Sep 22, 2007 8:14 pm    Post subject: It Worked>?? Reply with quote

Hi, well i manages do save the buttons as html, then in the index php added the include(buttons.html)

They then appeared but at the top of the page. Is there a way to insert the buttons in a specific place.?
Back to top View user's profile Send private message Send e-mail
svankamon
-


Joined: 01 Apr 2007
Posts: 148
Location: Chesterfield UK

PostPosted: Sat Sep 22, 2007 8:59 pm    Post subject: Reply with quote

To get 3 rows of buttons i did the folowing:

So here goes, i included the following lines in the index page (at the top)

include("topbuttons1.html");
include("topbuttons2.html");
include("topbuttons3.html");

each js file (referenced in the html file in the root folder) is in a folder with all the images for each set of buttons. The folders are named:

topbuttons1,
topbuttons2,
topbuttons3.

All images show up at the top of the indexpage and all pages within the script, All links work in the buttons.

Problem is only the bottom row of buttons changes image when i mouse over. ???
Hope you can help as i have no idea. If you can help id apreciate it. MAny thanks in advance for help thus far etc

Cheers.
Back to top View user's profile Send private message Send e-mail
svankamon
-


Joined: 01 Apr 2007
Posts: 148
Location: Chesterfield UK

PostPosted: Sat Sep 22, 2007 9:44 pm    Post subject: Done it Reply with quote

Thanks for your help i got them working it was obviously the image prefix.

However it would still be nice to place them differently using the opreviously named config ie include().

Thanks anyway. Cheers again.
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group