Please help me to move form selection fields to paren div.

Discussion in 'JavaScript' started by mxcape21, Jul 30, 2011.

  1. #1
    Hello everyone, noob here with a problem that I have been un able to solve in a week.
    I would like to put this in a div and move the form selection fields to the parent div, I am scrolling the rss output, so the selection fields need to be fixed or absolute position.
    here is the code;

    <html>
    <body>
    <p>&nbsp;</p>
    <p><b><small> </small></b></p>
    <p>&nbsp;</p>
    <div id="datacontainer" style="position: absolute; left: 0px; top: 2px; width: 760px; text-align: left; " onmouseover="scrollspeed=0" onmouseout="scrollspeed=cache"><!-- ADD YOUR SCROLLER CONTENT INSIDE HERE --><b><small>
    <p>&nbsp;</p>
    <p align="left"><b><span style="font-family: Verdana;"><small><iframe src="http://techraffle.com/rss/index.php" frameborder="0" height="3500" width="760"> </iframe></small></span><small><small> <!-- END SCROLLER CONTENT --></small></small></b></p>
    <small> <b><small> </small></b></small></small></b></div>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small><small> </small></small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small><small><b><small> </small></b></small></small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small><small> </small></small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small><small><b><small>
    <script type="text/javascript"><!--
    /***********************************************
    * IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    //Specify speed of scroll. Larger=faster (ie: 5)
    var scrollspeed=cache=1
    
    //Specify intial delay before scroller starts scrolling (in miliseconds):
    var initialdelay=10000
    
    function initializeScroller(){
    dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
    dataobj.style.top="5px"
    setTimeout("getdataheight()", initialdelay)
    }
    
    function getdataheight(){
    thelength=dataobj.offsetHeight
    if (thelength==0)
    setTimeout("getdataheight()",10)
    else
    scrollDiv()
    }
    
    function scrollDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
    if (parseInt(dataobj.style.top)<thelength*(-1))
    dataobj.style.top="5px"
    setTimeout("scrollDiv()",40)
    }
    
    if (window.addEventListener)
    window.addEventListener("load", initializeScroller, false)
    else if (window.attachEvent)
    window.attachEvent("onload", initializeScroller)
    else
    window.onload=initializeScroller
    // --></script>
    </small></b></small></small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small><small> <b><small> </small></b> </small></small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small><small>&nbsp;</small></small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small><small> </small></small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small>&nbsp;</small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small>&nbsp;</small></b></p>
    <p><b><small> </small></b></p>
    <p style="text-align: left;"><b><small>&nbsp;</small></b></p>
    <p><b><small> </small></b></p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    </body>
    </html>
    
    
    
    
    
    
    
    
    //---------------------------------------------------------------------------------------------------------------------------------------------//
    
    
    <link rel="icon" type="image/png" href="rss_include/feed-icon-red.png">
    <style language='text/css'>
      @import url('rss_include/style.css');
    </style>
    
    <script language="javascript">
        var XMLHttpRequestObject = false;
    	var img = new Image();
    	img.src = "rss_include/loading.gif";
        
        if ( window.XMLHttpRequest )
            XMLHttpRequestObject = new XMLHttpRequest();
        else if (window.ActiveXObject)
            XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
    
    	function changeOptions()
    	{
    		LoadFeed();
    	}
    	
    	function LoadFeed(value, initial)
    	{		
            if ( XMLHttpRequestObject )
            {
                var dsource = "rss_include/ajax.php?loadfeed"; 
    
    			if (value)
    				dsource += "=" + value;
    			else
    			{
    				var val = document.getElementById("rss_feed").value;
    				if ( val == "" )
    					document.getElementById("rss_feed").selectedIndex += 1;
    
    				dsource += "=" + document.getElementById("rss_feed").value;
    			}
    
    			dsource += "&fulltext=" + document.getElementById("showtext").checked;
    			dsource += "&showimages=" + document.getElementById("showimages").checked;
    			
                XMLHttpRequestObject.open("GET",dsource);
                XMLHttpRequestObject.onreadystatechange = function()
                {
    				if ( XMLHttpRequestObject.readyState != 4 )
    				{
    					document.getElementById("rss_div").innerHTML = "<center><img class=\"loading\" src=\"" + img.src + "\"></center>";	
    				}
    				
                    if ( XMLHttpRequestObject.readyState == 4 && 
                            XMLHttpRequestObject.status == 200 )
                    {
    					document.getElementById("rss_div").innerHTML = XMLHttpRequestObject.responseText;
                    }
                }
                XMLHttpRequestObject.send(null);
            }		
    	}
    </script>
    
    <?php
    
    require_once("rss_include/config.php");
    
    function LoadFile($xml_file)
    {
    	$xml = null;
    	if ( !file_exists($xml_file) || !($xml = simplexml_load_file($xml_file)) )
    	{
    		echo '</select>';
    		echo "Error opening XML feeds file: $xml_file<br>";
    		return;
    	}
    	
    	return $xml;
    }
    
    function ShowFeedOptions($xml_file)
    {	
    	echo '<select id="rss_feed" onChange="LoadFeed(this.value)" title="GuyWMustang.com RSS Reader">';
    	
    	$xml = LoadFile($xml_file);
    	if ( $xml == null )
    		return;
    	
    	$url = array();
    	foreach($xml->feeds->category as $category)
    	{
    		echo "<option value=\"\">" . $category['name'] . "</option>";
    		
    		foreach($category->feed as $feed)
    		{
    			if ( $feed['name'] != "" )
    			{
    				// Add a spacing to the feeds
    				$name = "&nbsp;&nbsp;&nbsp;&nbsp;" . $feed['name'];
    				$url = str_replace("&", "%26", $feed['url']);
    				$url = str_replace("http://", "", htmlspecialchars($url));
    				echo "<option value=\"$url\">" . $name . "</option>";
    			}
    		}
    	}
    	
    	echo '</select>';
    	
    	$options = array();
    	$rss = $xml->options[0];
    
    	if ( strcasecmp($rss['fulltext'],"true") == 0 )
    		array_push($options, "true");
    	else
    		array_push($options, "false");
    		
    	if ( strcasecmp($rss['images'],"true") == 0 )
    		array_push($options, "true");
    	else
    		array_push($options, "false");
    
    	return $options;
    }
    
    function SetOptions($options)
    {
    	if ( sizeOf($options) == 2 )
    	{
    		echo "<script>document.getElementById(\"showtext\").checked = " . $options[0] . ";</script>";
    		echo "<script>document.getElementById(\"showimages\").checked = " . $options[1] . ";</script>";
    	}
    }
    
    if ( isset($_GET['links']) )
    {
    	$xml = LoadFile($xml_file);
    	if ( $xml == null )
    		return;
    
    	// end the link editing
    	return;
    }
    
    ?>
    <div class="container" id="container_div">
    	<a name="top"></a>
    		<div class="header_div">
    			<div style="display:run-in;float:left;">
    			<font class="greytext">RSS Feed:</font>
    			<?php $options = ShowFeedOptions($feeds_xml); ?>
    			
    			<input type="checkbox" id="showtext" onChange="changeOptions(this)" checked><font class="greytext">Show Full Article Text</font>
    			<input type="checkbox" id="showimages" onChange="changeOptions(this)" checked><font class="greytext">Show Images</font>
    			</div>
    			
    			<?php SetOptions($options); ?>
    		</div>
    	<div class="rss" id="rss_div">
    		<script>LoadFeed(document.getElementById('rss_feed').value, true);</script>
    	</div>
    	<!-- <p style="padding:0px;margin-right:2px;margin:0px;" align="center"><a class="top" href="#top">Top</a></p> -->
    </div>
    
    
    
    
    
    Code (markup):

    Thanks :)
     
    Last edited: Jul 30, 2011
    mxcape21, Jul 30, 2011 IP
  2. programmer_best1

    programmer_best1 Well-Known Member

    Messages:
    282
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    133
    #2
    your code is very long.... please, can you simplify it so we can help you ?
     
    programmer_best1, Aug 18, 2011 IP