Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    68
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Formatting HTML of Javascript Output

    Hello - I was not sure where to put this - the CGI or Javascript file. Anyhow, I have a CGI counter that I pulled off the net, which I like a lot. The counter works perfectly.

    I am using Javascript to include the output (i.e. the counter) in my HTML file for now. Again, I have accomplished this too. However, I want to be able to apply css style to this particular output - nothing fancy, just a border and background and change the font and spacing. However, I am unsure how to accomplish this with the way I have it coded. You can visit the site at paradigmforward.com/alpine/index.html - the counter is at the VERY bottom.

    Here is the HTML:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>The Alpine Group Photography</title>
    <link href="styles/mainStyle.css" rel="stylesheet" type="text/css" />
    <script src="scripts/SpryMenuBar.js" type="text/javascript"></script>
    <script src="../../Scripts/swfobject_modified.js" type="text/javascript"></script>
    <script src="scripts/flashdetect.js" type="text/javascript"></script>
    <link href="styles/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <!--[if IE]> 
    <style type="text/css"> 
    ul.MenuBarHorizontal ul { 
      bottom:0; 
    } 
    </style> 
    <![endif]-->
    </head>
    
    <body>
    <div id="main">
      <div id="innerWrapper">
        <div id="header"><img src="img/header.png" width="930" height="184" alt="Alpine Group Photography" /></div><!--end header div-->
        <div id="content">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="770" height="600" id="alpineSlideShow" title="alpineSlideShow">
            <param name="movie" value="flash/slideshow.swf" />
            <param name="quality" value="high" />
            <param name="wmode" value="transparent" />
            <param name="swfversion" value="7.0.70.0" />
            <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you donít want users to see the prompt. -->
            <param name="expressinstall" value="scripts/expressInstall.swf" />
            <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="flash/slideshow.swf" width="770" height="600">
              <!--<![endif]-->
              <param name="quality" value="high" />
              <param name="wmode" value="transparent" />
              <param name="swfversion" value="7.0.70.0" />
              <param name="expressinstall" value="scripts/expressInstall.swf" />
              <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
              <div>
                <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
              </div>
              <!--[if !IE]>-->
            </object>
            <!--<![endif]-->
          </object>
          <h3>WELCOME TO ALPINE PHOTOGRAPHY ONLINE</h3>
            <p class="whtTxt-P">If you are looking for the highest quality event, occaision, school, wedding, and candid photography, then you have reached the right place! If you are <strong><em>not</em></strong> looking for the most  	professional, experienced, and advanced photography studio in the Franklin County/Roanoke, VA area, then you have reached the wrong place.<br /><br />
            Working with over 20+ years of experience, we have made it our mission to help our customers use imagery and imagination to their fullest extent to promote their products, services, activities, and precious moments.
            Communication is a vital component to the human experience and the old addage - <em>&quot;A picture is worth a thousand words...&quot;</em> - still rings as true today as it ever has. This is where we come in.<br /><br />
            Our challenge is to use practical &amp;insightful visuals to tell your story - whether on-site or in the studio. Whether the subjects be a business, a private group, family, or sports team - each has a story to tell. You can count on us to handle your photography needs from start to finish. So whether your goal is to preserve memories, commemerate an event, or increase your bottom line, <b>the Alpine Group can make a difference!</b><br /><br /></p>
        </div><!--end content div-->
        <div id="nav">
          <ul id="Navigation" class="MenuBarHorizontal">
            <li><a href="#"> Link 1</a></li>
            <li><a href="#">Link2</a></li>
            <li><a href="#">Link3</a></li>
            <li><a href="#" class="MenuBarItemSubmenu">Link4</a>
              <ul>
                <li><a href="#">Sub4.1</a></li>
                <li><a href="#">Sub4.2</a></li>
              </ul>
            </li>
            <li><a href="#">Link5</a></li>
            <li><a href="#">Link6</a></li>
            <li><a href="#" class="MenuBarItemSubmenu">Link7</a>
              <ul>
                <li><a href="#">Sublink1</a></li>
              </ul>
            </li>
          </ul>
        </div><!--end nav div-->
        <div id="footer"><img src="img/footer.gif" width="930" height="93" alt="Contact Alpine: 4528 Alean Rd. Boones Mill, VA 24065 | (540)312-4585 | alpine@jetbroadband.com" />
    	<script language=javascript>
         var rndURL = (1000*Math.random());
          document.write("<scr"+"ipt language=javascr"+"ipt src='http://paradigmforward.com/cgi-bin/csCounter/csCounter.cgi?id=1&js=1'></scr"+"ipt>");
          </script></div><!--end footer div-->
      </div><!--end innerWrapper div-->
    </div><!--end main div-->
    <script type="text/javascript">
    <!--
    var MenuBar1 = new Spry.Widget.MenuBar("Navigation", {imgDown:"../../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../../SpryAssets/SpryMenuBarRightHover.gif"});
    swfobject.registerObject("alpineSlideShow");
    //-->
    </script>
    </body>
    </html>

    The part of the code that I want to add styles to is here(towards the bottom).

    Code:
    <script language=javascript>
         var rndURL = (1000*Math.random());
          document.write("<scr"+"ipt language=javascr"+"ipt src='http://paradigmforward.com/cgi-bin/csCounter/csCounter.cgi?id=1&js=1'></scr"+"ipt>");
    I am sure this is easy, but cannot figure it out. I would like to keep it within the footer div. Thanks!

    Mike

  • #2
    New Coder
    Join Date
    Feb 2009
    Posts
    68
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Okay, so I was investigating further and I was thinking way too hard about it. I actually needed to post this in the CGI forum, as the code passed by the CGI file via JS is what I need to change - I simply need to add the styling here (just need to figure out the correct syntax as CGI is something I do not usually use that much). IF AN ADMIN OR MOD WANTS TO MOVE THIS TO CGI - PLEASE DO. THANKS!

    Code:
    if($in{'js'} == 1){
    	print "document.write('$count')\n";
    	}
    else{
    	print $count;
    	}

  • #3
    New Coder
    Join Date
    Feb 2009
    Posts
    68
    Thanks
    12
    Thanked 0 Times in 0 Posts
    I figured out the formatting. I simply formatted a <p> tag within my footer div and added the info like this:

    Code:
    if($in{'js'} ==1){
            print "document.write('<p>$count</p>')\n";
            }
    else{
            print $count;
          }

    Now I just need to know how to add a link in there. I can figure everything out, except how to add the quotes for the link href. For instance:

    Code:
    if($in{'js'} ==1){
            print "document.write('<p><a href="http://www.somelink.com/">$count</a></p>')\n";
            }
    else{
            print $count;
          }
    Obviously the quotes around the link are throwing an error. I am sure it is something easy, but cannot quite figure it out at the moment.

    Mike


  •  

    Posting Permissions

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