Results 1 to 3 of 3

Thread: ddsmoothmenu problem

  1. #1
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ddsmoothmenu problem

    1) Script Title: Smooth Navigational Menu

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...smoothmenu.htm

    3) Describe problem: I am using this menu very successfully across a website. But I have a set of pages where I am using some javascrpit to enable users to print out instructions from a page. The code opens a new browser preview window that displays just the instructions from the web page, these being defined by the js print code, and a print window .

    The problem is that the new browser window does not have any menu included (since I only want to print a selected part of the page) and thus generates an error.

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.1; InfoPath.1; .NET CLR 2.0.50727; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
    Timestamp: Sun, 30 Oct 2011 11:51:14 UTC

    Message: 'ddsmoothmenu' is undefined
    Line: 144
    Char: 1
    Code: 0

    Is there a way to stop the page looking for a non-existent menu? Some type of additional code or instruction to stop the error?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The exact detection code to add depends on which part of the page is missing inside the print preview window. If it's all the script references except the invocation code of the menu, in other words, this part:

    Code:
    <script type="text/javascript">
    
    ddsmoothmenu.init({
    	mainmenuid: "smoothmenu1", //menu DIV id
    	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
    	classname: 'ddsmoothmenu', //class added to menu's outer DIV
    	//customtheme: ["#1c5a80", "#18374a"],
    	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
    })
    
    </script>
    Then, to avoid the above code generating the said error when it's called without any of the support JS references in place is to modify it to the below instead:

    Code:
    <script type="text/javascript">
    
    try{
    ddsmoothmenu.init({
    	mainmenuid: "smoothmenu1", //menu DIV id
    	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
    	classname: 'ddsmoothmenu', //class added to menu's outer DIV
    	//customtheme: ["#1c5a80", "#18374a"],
    	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
    })
    
    }catch(e){}
    </script>
    DD Admin

  3. #3
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the information. That change eliminates the error while everything else in the site still works fine.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •