SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is wrong with this javascript?

    It will not run... I think it may be the detection of the radio boxes.

    Code JavaScript:
    function preview(document) {
       windowName = "Preview";
       var font = new Array();
       font[0] = '';
       font[1] = 'Arial';
       font[2] = 'Courier New';
       font[3] = 'Georgia';
       font[4] = 'Impact';
       font[5] = 'Lucida Console';
       font[6] = 'Tahoma';
       font[7] = 'Times New Roman';
       font[8] = 'Verdana';
       var link_effect = new Array();
       link_effect[0] = '';
       link_effect[1] = 'Underline';
       link_effect[2] = 'Overline';
       link_effect[3] = 'Underline Overline';
       link_effect[4] = 'Strikethrough';
       link_effect[5] = 'None';
       var visited_effect = new Array();
       visited_effect[0] = '';
       visited_effect[1] = 'Underline';
       visited_effect[2] = 'Overline';
       visited_effect[3] = 'Underline Overline';
       visited_effect[4] = 'Strikethrough';
       visited_effect[5] = 'None';
       var hover_effect = new Array();
       hover_effect[0] = '';
       hover_effect[1] = 'Underline';
       hover_effect[2] = 'Overline';
       hover_effect[3] = 'Underline Overline';
       hover_effect[4] = 'Strikethrough';
       hover_effect[5] = 'None';
       if (document.getElementById('page_background_type_Color').checked) {
          var page_background_type = 'Color';
       }
       if (document.getElementById('page_background_type_Image').checked) {
          var page_background_type = 'Image';
       }
       if (document.getElementById('module_background_type_Color').checked) {
          var module_background_type = 'Color';
       }
       if (document.getElementById('module_background_type_Image').checked) {
          var module_background_type = 'Image';
       }
       if (document.getElementById('module_border_Yes').checked) {
          var module_border= 'Yes';
       }
       if (document.getElementById('module_border_No').checked) {
          var module_border = 'No';
       }
       if (document.getElementById('module_border_type_Solid').checked) {
          var module_border_type= 'Solid';
       }
       if (document.getElementById('module_border_type_Dotted').checked) {
          var module_border_type = 'Dotted';
       }
       var border_width = new Array();
       border_width[0] = '';
       border_width[1] = 'Underline';
       border_width[2] = 'Overline';
       border_width[3] = 'Underline Overline';
       if (document.getElementById('divider_border_Yes').checked) {
          var divider_border = 'Yes';
       }
       if (document.getElementById('divider_border_No').checked) {
          var divider_border = 'No';
       }
       if (document.getElementById('divider_border_type_Solid').checked) {
          var divider_border_type= 'Solid';
       }
       if (document.getElementById('divider_border_type_Dotted').checked) {
          var divider_border_type = 'Dotted';
       }
       var divider_border_width = new Array();
       divider_border_width[0] = '';
       divider_border_width[1] = 'Underline';
       divider_border_width[2] = 'Overline';
       divider_border_width[3] = 'Underline Overline';
       var main_font_size = new Array();
       main_font_size[0] = '';
       main_font_size[1] = 'Tiny';
       main_font_size[2] = 'Small';
       main_font_size[3] = 'Medium';
       main_font_size[4] = 'Large';
       main_font_size[5] = 'Huge';
       var headline_font_size = new Array();
       headline_font_size[0] = '';
       headline_font_size[1] = 'Tiny';
       headline_font_size[2] = 'Small';
       headline_font_size[3] = 'Medium';
       headline_font_size[4] = 'Large';
       headline_font_size[5] = 'Huge';
       var small_print_font_size = new Array();
       small_print_font_size[0] = '';
       small_print_font_size[1] = 'Tiny';
       small_print_font_size[2] = 'Small';
       small_print_font_size[3] = 'Medium';
       windowURL = '/preview' + '?' + 'title=' + document.getElementById('LayoutTitle').value + '&font=' + font[document.getElementById('LayoutFont').options.selectedIndex] + '&link_color=' + document.getElementById('LayoutLinkColor').value + '&link_effect=' + link_effect[document.getElementById('LayoutLinkEffect').options.selectedIndex] + '&visited_color=' + document.getElementById('LayoutVisitedColor').value + '&visited_effect=' + visited_effect[document.getElementById('LayoutVisitedEffect').options.selectedIndex] + '&hover_color=' + document.getElementById('LayoutHoverColor').value + '&hover_effect=' + hover_effect[document.getElementById('LayoutHoverEffect').options.selectedIndex] + '&page_background_type=' + page_background_type + '&page_background=' + document.getElementById('LayoutPageBackground').value + '&module_background_type=' + module_background_type + '&module_background=' + document.getElementById('LayoutModuleBackground').value + '&module_border_type=' + module_border_type + '&module_border_color=' +  document.getElementById('LayoutModuleBorderColor').value + '&border_width=' + border_width[document.getElementById('LayoutBorderWidth').options.selectedIndex] + '&divider_border=' + divider_border + '&divider_border_type=' + divider_border_type + '&divider_border_color=' document.getElementById('LayoutDividerBorderColor').value + '&divider_border_width=' + divider_border_width[document.getElementById('LayoutDividerBorderWidth').options.selectedIndex] + '&main_font_size=' + main_font_size[document.getElementById('LayoutMainFontSize').options.selectedIndex] + '&main_font_color=' + document.getElementById('LayoutMainFontColor').value + '&headline_font_size=' + headline_font_size[document.getElementById('LayoutHeadlineFontSize').options.selectedIndex] + '&headline_font_color=' + document.getElementById('LayoutHeadlineFontColor').value + '&small_print_font_size=' + small_print_font_size[document.getElementById('LayoutSmallPrintFontSize').options.selectedIndex] + '&small_print_font_color=' + document.getElementById('LayoutSmallPrintFontColor').value;
       myWindow = window.open(windowURL,windowName);
       myWindow.focus();
    }
    Have a good day.

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When running it in firefox, does the error console throw anything?

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    It's the divider_border_color where the trouble is occuring. It's missing a +
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •