Subject: Problems with Body onload event
Posted By: blaabil Post Date: 1/6/2006 5:45:54 AM
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 & ">"
        response.Write(strMenuHold)
    End If
    
%>
-----------------

Hope someone can help!

Heidi


Go to topic 7792

Return to index page 402
Return to index page 401
Return to index page 400
Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393