Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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 January 6th, 2006, 06:45 AM
Authorized User
Join Date: Mar 2004
Location: , , United Kingdom.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with Body onload event

Hi there

I've just realised that the onload event is only valid for <body> and <frameset> after trying to validate my new website!

So, I have tried to incorporate the onload event I previously had on a 1 pixel invisible gif into the body tag, but Dreamweaver keeps crashing every time I try, so I'm guessing I've got it wrong!

My website has an expandable menu which uses javascript to open and close submenus acording to my CSS style sheet. This works OK and validates fine.
My problems occurs when I try to set my breadcrumbs to open and close these submenus according to where in the site you navigate to. The image onload event works fine, but will not pass W3 validation.

Has anyone got an idea as to how I can assign this function to the body tag?

Here's the ASP with the event:

    Dim strMenuHold
    Dim strMenuPos
    Dim strMenuText
        Dim DQ

        DQ = """"

    strMenuText = arrstrSplit(1)

    Select Case strMenuText
        Case "Undergraduate"
            strMenuPos = "0"
        Case "Postgraduate"
            strMenuPos = "1"
        Case "Research"
            strMenuPos = "2"
        Case "Companies"
            strMenuPos = "3"
        Case "FAQ"
            strMenuPos = ""
        Case "Us"
            strMenuPos = "4"
        Case "Events"
            strMenuPos = "5"
    End Select

'//////Build strMenuHold to open correct part of menu///////

    If StrMenuPos <> "" then
        strMenuHold = "<Img src=" & DQ & "/shprsdev/images/small.gif" & DQ & " alt=" & DQ & " " & DQ & " width=" & DQ & "1" & DQ & " height=" & DQ & "1" & DQ & " onLoad=" & DQ & "expandMenu(" & strMenuPos & "); return false;" & DQ & ">"
    End If


Hope someone can help!


Reply With Quote

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
Invoke onClick() function when body onLoad muklee Javascript How-To 2 March 16th, 2007 01:02 AM
Double DB insert using body.onload needlz BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 February 20th, 2006 04:18 PM
Accessing the value of a Cell in Onload event asdasd Javascript 1 February 19th, 2005 04:50 AM
Body Onload Function Question apd8x Javascript 2 July 10th, 2003 02:52 AM

All times are GMT -4. The time now is 04:42 PM.

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