Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4
This is the forum to discuss the Wrox book Beginning Dreamweaver MX by Charles E. Brown, Imar Spaanjaars, Todd Marks; ISBN: 9780764544040
Please indicate which version of the book you are using when posting questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 25th, 2004, 12:28 PM
Registered User
 
Join Date: Oct 2004
Location: purmerend, nh, Netherlands.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Soccersite javascript problem

Hi,

I've come to page 248 and finaly tried my page after typing in some code. but it doesn't display the menu bigger and bolder as it should.
(the javascript should display the HOME text bigger and bolder)
All menu items are the same size and the statusbar indicates that the page is ready but with errors.

I checked the code and even copy pasted the code from the downloadable code at wrox (the code for chapter 7) but this doesn't change a thing.

When i look at the code in the browser it seems to be ok (it shows the text '/thesoccersite/home.asp') but still it doesn't work.
I'll post both the template code and the browser code after this:

Best regards,

Edwin Frinking


[u]template code:</u>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="../images/logo.gif" width="257" height="58"></td>
    <td>
        <table border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
          <td><a href="../home.asp" id="home">Home</a></td>
            <td>&nbsp;&nbsp;&nbsp;</td>
            <td><a href="../events.asp" id="events">Events</a></td>
            <td>&nbsp;&nbsp;&nbsp;</td>
            <td><a href="../mysite.asp" id="mysite">MySite</a></td>
  </tr>
</table>
</td>
  </tr>
</table>
<br>
<script language="JavaScript" type="text/javascript">
    var sPageName = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
    sPageName = sPageName.substr(sPageName.lastIndexOf('/') + 1).toLowerCase();
    sPageName = sPageName.substr(0, sPageName.lastIndexOf('.'));
    if (document.getElementById(sPageName))
    {
            document.getElementById(sPageName).style.fontWeigh t = 'Bold';
            document.getElementById(sPageName).style.fontSize = '14pt';
    }
</script>

[u]browser code:</u>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="images/logo.gif" width="257" height="58"></td>
    <td>
        <table border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
          <td><a href="home.asp" id="home">Home</a></td>
            <td>&nbsp;&nbsp;&nbsp;</td>
            <td><a href="Events.asp" id="events">Events</a></td>
            <td>&nbsp;&nbsp;&nbsp;</td>
            <td><a href="MySite.asp" id="mysite">MySite</a></td>
  </tr>
</table>
</td>
  </tr>
</table>
<br>
<script language="javascript" type="text/javascript">
    var sPageName = '/thesoccersite/home.asp';
        sPageName = sPageName.substr(sPageName.lastIndexOf('/')
                    + 1).toLowerCase();
        sPageName = sPageName.substr(0, sPageName.lastIndexOf('.'));
    If (document.getElementById(sPageName))
    {
    document.getElementById(sPageName).style.fontWeigh t = 'Bold';
    document.getElementById(sPageName).style.fontSize = '14pt';
    }
    </script><table width="100%" border="0" cellspacing="0" cellpadding="0">
<br>
  #2 (permalink)  
Old October 25th, 2004, 02:43 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Edwin,

You have written If with a capital I. However, in JavaScript, if is with a lower case i:

If (document.getElementById(sPageName))

should be:

if (document.getElementById(sPageName))

If you fix that, I think the menu will work. If not, let me know.

HtH,

Imar

P.S. Heb je een beetje lol met het boek?

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Forty six & 2 by Tool (Track 5 from the album: Aenima) What's This?
  #3 (permalink)  
Old October 25th, 2004, 05:54 PM
Registered User
 
Join Date: Oct 2004
Location: london, , United Kingdom.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I to am having a problem getting the menu item when selected to show bigger! The code I am using is reproduced below. I have gone through it with a fine toothcomb but cannot for the life of me find the error! could you please help?

Iain


<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="../Images/logo.gif" alt="logo" width="257" height="58"></td>
    <td><table border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="../home.asp" id="home">Home</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="../events.asp" id="events">Events</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="../mysite.asp" id="mysite">My Site</a></td>
  </tr>
</table>
</td>
  </tr>
</table>
<br>
<script language="JavaScript" type="text/javascript">
var sPageName = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
sPageName = sPageName.substr(sPageName.lastIndexOf('/')
+ 1).toLowerCase();
sPageName = SPageName.substr(0, sPageName.lastIndexOf('.'));
if (document.getElementById(sPageName))
{
    document.getElementById(sPageName).style.fontWeigh t='Bold';
    document.getElementById(sPageName).style.fontSize= '14pt';
}
</script>

  #4 (permalink)  
Old October 26th, 2004, 01:19 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I think you need an even finer comb ;) Take a look at this:

sPageName = SPageName

You're mixing the case of the sPageName variable.....


HtH,

Imar
  #5 (permalink)  
Old October 26th, 2004, 02:44 AM
Registered User
 
Join Date: Oct 2004
Location: london, , United Kingdom.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar


It worked many thanks for you prompt reply.

I must have gone 'word blind' I must blame you.....your book is so addictive I can't put it down!

The Drreamweaver book is excellent; I have tried many so called 'teaching books' but Wrox are by far the best. I was also encouraged to see such an active forum and am very appreciative of your prompt reply to my query. I already have Wrox books to learn Javascript and ASP.NET because of my experience with your Dreamweaver book. Once again many thanks to you..and the other authors.



  #6 (permalink)  
Old October 26th, 2004, 04:23 AM
Registered User
 
Join Date: Oct 2004
Location: purmerend, nh, Netherlands.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi imar,

it works now, strangly enough when I look at the template it was writen in lowercase but in the home.asp and events.asp it was writen in uppercase.
this is strange as I let dreamweaver update the pages when asked for at save.
I set it to upper again and updated then changed it to lower and updated again and checked if it was changed in home.asp and events.asp and now it is changed and it works!

chanks a lot...it's so simple right!

best regards

Edwin frinking

ps. lol ja dat kun je wel zeggen, ik heb het zelden zo leuk gevonden om weer eens iets te leren sinds ik van school af ben.
misschien omdat je direct een visueel resultaat hebt.
groeten edwin
  #7 (permalink)  
Old February 20th, 2005, 08:20 PM
Authorized User
 
Join Date: Jan 2005
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 I am also having the problem of the Home link not looking bold or larger...

Here is the code that I have used:
<script language="JavaScript" type="text/javascript">
var sPageName = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
sPageName = sPageName.substr(sPageName.lastIndexOf('/') + 1).toLowercase();
sPageName = sPageName.substr(0, sPageName.lastIndexOf('.'));
if (document.getElementById(sPageName))
{
document.getElementById(sPageName).style.fontweigh t = 'Bold';
document.getElementById(sPageName).style.fontsize = '14pt';
}
</script>

I am sure it is just something silly I have missed, but I can't find it!

Thanks in advance!

  #8 (permalink)  
Old February 21st, 2005, 01:23 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

What do you see when you look at the HTML source in the browser?

Do you see the actual page name, or do you still see

<%=Request.ServerVariables("SCRIPT_NAME")%>

Can you post the (relevant parts of) the HTML source?

Cheers,

Imar
  #9 (permalink)  
Old February 21st, 2005, 02:04 PM
Authorized User
 
Join Date: Jan 2005
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forgive my complete ignorance, but how do I look at the code in the browser?? I am totally embarrassed that I have to ask that...

  #10 (permalink)  
Old February 21st, 2005, 04:22 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Right-click somewhere on the page in the browser, and then choose View Source....

No worries about asking this; after all, that's why you are a TotalNewbie, aren't you? ;)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 2 December 7th, 2006 02:39 AM
Javascript Problem dparsons ASP.NET 1.0 and 1.1 Basics 2 March 22nd, 2006 01:41 PM
Help: problem with javascript hilechen Javascript 1 December 6th, 2005 06:58 AM
Beginning D.W.2004 SoccerSite terry s Dreamweaver (all versions) 7 October 26th, 2004 03:25 PM
Javascript problem highcliffevillage Javascript How-To 0 July 8th, 2004 07:13 AM



All times are GMT -4. The time now is 11:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.