+ Reply to Thread
Results 1 to 11 of 11




  

Thread: document.getElementById - Help needed

      
  1. #1
    I'm New! ferrariboy21 is on a distinguished road ferrariboy21's Avatar
    Join Date
    June 10, 2008
    Location
    Liverpool lives in me
    Posts
    35
    Rep Power
    4
    Feedback Score
    0

    Default document.getElementById - Help needed

    Picture:
    http://img221.imageshack.us/img221/6710/a1to2.jpg


    if ( document.getElementById ( "input_field_1" ).value != "" )
    color = document.getElementById ( "input_field_1" ).value;
    else
    color = "#AFD8F8";

    Currently, using the code above. If I click on the first color button, the whole graph changes to the color chosen.

    How do I make it that if I want different colors on different bars assuming the others are using "input_field_#". So if I want "Q2" to be green, "Q3" to be purple and so on, how do i do that?

  2. #2
    Jedi Master eugen will become famous soon enougheugen will become famous soon enough eugen's Avatar
    Join Date
    May 3, 2008
    Posts
    275
    Rep Power
    5
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    Are you using "color" variable for all 3 columns ?

    Probably it's better to have color1, color2 and color3.
    + Jobs in London, follow us on twitter @jobsplaza
    +

  3. #3
    I'm New! ferrariboy21 is on a distinguished road ferrariboy21's Avatar
    Join Date
    June 10, 2008
    Location
    Liverpool lives in me
    Posts
    35
    Rep Power
    4
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    I haven't create any variables for the rest because I'm not sure how it'll work?

    Let me copy and paste the whole code for you.

    Code:
    <html>
    <head>
    <script src="201a.js" type="text/javascript"></script>
    
    <style type="text/css" media="screen">
    html, body {
    margin: 0;
    padding: 0;
    background: #8B8878;
    color: #fff;
    height: 99%;
    text-align: center;
    }
    
    #container {
    position: relative;
    width: 760px;
    margin: 7px auto;
    text-align: left;
    background: #8B8878;
    min-height: 99%; /* this is where inheritance stops */
    }
    
    /* if you remove this then the container disappears in IE */
    * html #container {
    height: 99%;
    } 
    
    #footer
    {
    position: absolute;
    bottom: 0;
    margin: 0 0 0 0;
    padding: 0 0 10px 0;
    height: auto;
    width: 760px;
    background: #4c4c4c;
    }
    
    #top-row
    {
    margin: 0 0 0 0;
    padding: 0 90px 60px 90px;
    width: 580px;
    color: #4c4c4c;
    }
    
    </style> 
    <script src="201a.js" type="text/javascript"></script>
    <script type="text/javascript">
    function ShowInputs()
    {
    	var idx=document.getElementById ( "menu1" ).selectedIndex-1;
    	var i=0;
    	var valuearray = new Array ();
    	for (i=0;i<=idx;i++) {
    		var inputid = "input"+i;
    		if ( document.getElementById ( inputid ) != null ) {
    			if ( document.getElementById ( inputid ).value != "" )
    				valuearray[i] = document.getElementById ( inputid ).value;
    		}
    		else
    			valuearray[i] = "Fill in value";
    	}
            // reset container content before adding inputs
           document.getElementById('container').innerHTML = '';
    
    	for (i=0;i<=idx;i++)
    	{
    
                   document.getElementById('container').innerHTML += '<input type="text" id="input'+i+'" value="'+valuearray[i]+'"/><br />';
    	}
    }
    
    </script>
    <div style="float:right; left:70%;">
    <TITLE>Our Final Year Project Assignment</TITLE>	
    	<style type="text/css">
    	<!--
    	body {
    		font-family: Arial, Helvetica, sans-serif;
    		font-size: 12px;
    	}
    	-->
    	</style>
    	<SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
    	<SCRIPT LANGUAGE="JavaScript">
    		//We store the XML data as a string
    		var strXML = "<graph animation='0' caption='Average Marks' showNames='1'><set name='Q1' value='72' color='AFD8F8'/><set name='Q2' value='72' color='AFD8F8'/><set name='Q3' value='72' color='AFD8F8'/><set name='Q4' value='72' color='AFD8F8'/><set name='Q5' value='72' color='AFD8F8'/><set name='Q6' value='72' color='AFD8F8'/><set name='Q7' value='72' color='AFD8F8'/><set name='Q8' value='72' color='AFD8F8'/><set name='Q9' value='72' color='AFD8F8'/><set name='Q10' value='72' color='AFD8F8'/></graph>";
    		var currentChartSWF;
    		/*
    		 * updateChart method is called, when user clicks the button
    		 * Here, we change the chart from Column to line
    		*/
    		function updateChart(chartSWF){
    			if ( chartSWF == undefined )
    				chartSWF = currentChartSWF;
    			//alert ( "chartSWF "+chartSWF+" currentChartSWF "+currentChartSWF );
    			//alert ( "strXML "+strXML );
    			//Create another instance of the chart.
    			var chart1 = new FusionCharts(chartSWF, "chart1Id", "500", "300", "0", "0");		   			
    			chart1.setDataXML(strXML);
    			chart1.render("chart1div");
    			currentChartSWF = chartSWF;
    		}
    		function generateGraph () {
    		alert ( document.getElementById ( "input_field_1" ).value );
    		if ( document.getElementById ( "input_field_1" ).value != "" )
    			color = document.getElementById ( "input_field_1" ).value;
    		else
    			color = "#AFD8F8";
    
    strXML = "<graph animation='0' caption='Average Marks' showNames='1'>";
    for ( i = 0; i < document.getElementById ( "menu1" ).value; i++ ) {
    	var inputid = "input"+i;
    	strXML += "<set name='Q"+(i+1)+"' value='"+document.getElementById ( inputid ).value+"' color='"+color+"'/>";	
    }
    strXML += "</graph>";
    			updateChart ();
    		}
    
    		function resetGraph () {
    			strXML = "<graph animation='0' caption='Average Marks' showNames='1'><set name='Q1' value='0' color='AFD8F8'/><set name='Q2' value='0' color='AFD8F8'/><set name='0' value='0' color='AFD8F8'/><set name='Q4' value='0' color='AFD8F8'/><set name='Q5' value='0' color='AFD8F8'/><set name='Q6' value='0' color='AFD8F8'/><set name='Q7' value='0' color='AFD8F8'/><set name='Q8' value='0' color='AFD8F8'/><set name='Q9' value='0' color='AFD8F8'/><set name='Q10' value='1' color='AFD8F8'/></graph>";
    			updateChart ();
    		}
    
    	</SCRIPT>
    </div>
    </head>
    <body>
    <div id="colorpicker201" class="colorpicker201"></div>
    <br>
    <br><br>
    <CENTER>
    
    		<h2>Our Final Year Project Assignment</h2>
    		
    		<div id="chart1div">
    			FusionCharts
    		</div>
    		<script language="JavaScript">					
    			var chart1 = new FusionCharts("../../FusionCharts/Frontpage.swf", "chart1Id", "500", "300", "0", "0");
    			chart1.setDataXML(strXML);
    			chart1.render("chart1div");
    		</script>
    		<BR />
    <div style="float:left; width:25%;">
    		<form name='frmUpdate'>
    		<b>Type of Graph</b><br>
    		<select name="mydropdown">
    		<option value='Column' onClick="javaScript:updateChart('../../FusionCharts/Frontpage.swf');"></option>
    		<option value="Bar Graph" value='Column' onClick="javaScript:updateChart('../../FusionCharts/FCF_Column3D.swf');" name='btnColumn' />Bar Graph</option>
    		<option value="Line Graph" value='Line' onClick="javaScript:updateChart('../../FusionCharts/FCF_Line.swf');" name='btnLine' />Line Graph</option>
    		<option value="Pie Graph" value='Pie' onClick="javaScript:updateChart('../../FusionCharts/FCF_Pie3D.swf');" name='btnPie' />Pie Graph</option>		
    		</select></form>
    <b>No of Inputs</b><br>
    <form name="form1">
      <select id="menu1" name="menu1" onChange="ShowInputs()">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
      </select>
    <div id="container"></div>
    	<p align='center'><input type="button" value="Generate Graph" onclick="javascript:generateGraph ( '' )"></p>
    	<p align='center'><input type="button" value="Reset Graph" onclick="javascript:resetGraph ( '' )"></p></form>
    <form action="" onsubmit="isThatAColor(this.elements[0].value); return false;">
                <div id="colorpicker201" class="colorpicker201"></div>
    <input type="button" onclick="showColorGrid2('input_field_1','sample_1');" value="...">&nbsp;<input type="hidden" id="input_field_1" size="9" value="">&nbsp;<input type="text" id="sample_1" size="1" value="" />
    <br></br>
    <div id="colorpicker201" class="colorpicker201"></div>
    <input type="button" onclick="showColorGrid2('input_field_2','sample_2');" value="...">&nbsp;<input type="hidden" id="input_field_2" size="9" value="">&nbsp;<input type="text" id="sample_2" size="1" value="" />
    
    </div>
    </form>
    <div id="container"></div>
    </CENTER>
    <br style="clear:both;" />
    </body>
    </html>

  4. #4
    Jedi Master JHalstead will become famous soon enoughJHalstead will become famous soon enoughJHalstead will become famous soon enough JHalstead's Avatar
    Join Date
    January 3, 2008
    Location
    OKC, OK - USA
    Posts
    147
    Rep Power
    5
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    This should get you started.

    I changed your code so the color boxes are also created when you pick number. The showinputs and generategraph functions have been updated along with the isthatacolor form. hope this helps.

    Code:
    <html>
    <head>
    <script src="201a.js" type="text/javascript"></script>
    
    <style type="text/css" media="screen">
    html, body {
    margin: 0;
    padding: 0;
    background: #8B8878;
    color: #fff;
    height: 99%;
    text-align: center;
    }
    
    #container {
    position: relative;
    width: 760px;
    margin: 7px auto;
    text-align: left;
    background: #8B8878;
    min-height: 99%; /* this is where inheritance stops */
    }
    
    /* if you remove this then the container disappears in IE */
    * html #container {
    height: 99%;
    } 
    
    #footer
    {
    position: absolute;
    bottom: 0;
    margin: 0 0 0 0;
    padding: 0 0 10px 0;
    height: auto;
    width: 760px;
    background: #4c4c4c;
    }
    
    #top-row
    {
    margin: 0 0 0 0;
    padding: 0 90px 60px 90px;
    width: 580px;
    color: #4c4c4c;
    }
    
    </style> 
    <script src="201a.js" type="text/javascript"></script>
    <script type="text/javascript">
    function ShowInputs()
    {
    	var idx=document.getElementById ( "menu1" ).selectedIndex-1;
    	var i=0;
    	var valuearray = new Array ();
    	for (i=0;i<=idx;i++) {
    		var inputid = "input"+i;
    		if ( document.getElementById ( inputid ) != null ) {
    			if ( document.getElementById ( inputid ).value != "" ) {
    				valuearray[i] = document.getElementById ( inputid ).value;
                }
    		} else valuearray[i] = "Fill in value";
    	}
            // reset container content before adding inputs
           document.getElementById('container').innerHTML = '';
           document.getElementById('colorsel').innerHTML = '';
    
    	for (i=0;i<=idx;i++)
    	{
    		document.getElementById('container').innerHTML += '<input type="text" id="input'+i+'" value="'+valuearray[i]+'"/><br />';
            document.getElementById('colorsel').innerHTML += '<div id="colorpicker201" class="colorpicker201"></div><input type="button" onclick="showColorGrid2(\'input_field_'+i+'\',\'sample_'+i+'\');" value="...">&nbsp;<input type="hidden" id="input_field_'+i+'" size="9" value="">&nbsp;<input type="text" id="sample_'+i+'" size="1" value="" /><br></br>';
    	}
    }
    
    </script>
    <div style="float:right; left:70%;">
    <TITLE>Our Final Year Project Assignment</TITLE>	
    	<style type="text/css">
    	<!--
    	body {
    		font-family: Arial, Helvetica, sans-serif;
    		font-size: 12px;
    	}
    	-->
    	</style>
    	<SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
    	<SCRIPT LANGUAGE="JavaScript">
    		//We store the XML data as a string
    		var strXML = "<graph animation='0' caption='Average Marks' showNames='1'><set name='Q1' value='72' color='AFD8F8'/><set name='Q2' value='72' color='AFD8F8'/><set name='Q3' value='72' color='AFD8F8'/><set name='Q4' value='72' color='AFD8F8'/><set name='Q5' value='72' color='AFD8F8'/><set name='Q6' value='72' color='AFD8F8'/><set name='Q7' value='72' color='AFD8F8'/><set name='Q8' value='72' color='AFD8F8'/><set name='Q9' value='72' color='AFD8F8'/><set name='Q10' value='72' color='AFD8F8'/></graph>";
    		var currentChartSWF;
    		/*
    		 * updateChart method is called, when user clicks the button
    		 * Here, we change the chart from Column to line
    		*/
    		function updateChart(chartSWF){
    			if ( chartSWF == undefined )
    				chartSWF = currentChartSWF;
    			//alert ( "chartSWF "+chartSWF+" currentChartSWF "+currentChartSWF );
    			//alert ( "strXML "+strXML );
    			//Create another instance of the chart.
    			var chart1 = new FusionCharts(chartSWF, "chart1Id", "500", "300", "0", "0");		   			
    			chart1.setDataXML(strXML);
    			chart1.render("chart1div");
    			currentChartSWF = chartSWF;
    		}
    		function generateGraph () {
    strXML = "<graph animation='0' caption='Average Marks' showNames='1'>";
    for ( i = 0; i < document.getElementById ( "menu1" ).value; i++ ) {
    	var inputid = "input"+i;
    	var inputfieldid = "input_field_"+i;
    	var colorid = "color"+i;
    	
        if ( document.getElementById( inputfieldid ).value != "" )
    			colorid = document.getElementById ( inputfieldid ).value;
    		else
    			colorid = "#AFD8F8";	
    
    	strXML += "<set name='Q"+(i+1)+"' value='"+document.getElementById ( inputid ).value+"' color='"+colorid+"'/>";	
    }
    strXML += "</graph>";
    			updateChart ();
    		}
    
    		function resetGraph () {
    			strXML = "<graph animation='0' caption='Average Marks' showNames='1'><set name='Q1' value='0' color='AFD8F8'/><set name='Q2' value='0' color='AFD8F8'/><set name='0' value='0' color='AFD8F8'/><set name='Q4' value='0' color='AFD8F8'/><set name='Q5' value='0' color='AFD8F8'/><set name='Q6' value='0' color='AFD8F8'/><set name='Q7' value='0' color='AFD8F8'/><set name='Q8' value='0' color='AFD8F8'/><set name='Q9' value='0' color='AFD8F8'/><set name='Q10' value='1' color='AFD8F8'/></graph>";
    			updateChart ();
    		}
    
    	</SCRIPT>
    </div>
    </head>
    <body>
    <div id="colorpicker201" class="colorpicker201"></div>
    <br>
    <br><br>
    <CENTER>
    
    		<h2>Our Final Year Project Assignment</h2>
    		
    		<div id="chart1div">
    			FusionCharts
    		</div>
    		<script language="JavaScript">					
    			var chart1 = new FusionCharts("../../FusionCharts/Frontpage.swf", "chart1Id", "500", "300", "0", "0");
    			chart1.setDataXML(strXML);
    			chart1.render("chart1div");
    		</script>
    		<BR />
    <div style="float:left; width:25%;">
    		<form name='frmUpdate'>
    		<b>Type of Graph</b><br>
    		<select name="mydropdown">
    		<option value='Column' onClick="javascript:updateChart('../../FusionCharts/Frontpage.swf');"></option>
    		<option value="Bar Graph" value='Column' onClick="javascript:updateChart('../../FusionCharts/FCF_Column3D.swf');" name='btnColumn' />Bar Graph</option>
    		<option value="Line Graph" value='Line' onClick="javascript:updateChart('../../FusionCharts/FCF_Line.swf');" name='btnLine' />Line Graph</option>
    		<option value="Pie Graph" value='Pie' onClick="javascript:updateChart('../../FusionCharts/FCF_Pie3D.swf');" name='btnPie' />Pie Graph</option>		
    		</select></form>
    <b>No of Inputs</b><br>
    <form name="form1">
      <select id="menu1" name="menu1" onChange="ShowInputs()">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
      </select>
    <div id="container"></div>
    	<p align='center'><input type="button" value="Generate Graph" onclick="javascript:generateGraph ( '' )"></p>
    	<p align='center'><input type="button" value="Reset Graph" onclick="javascript:resetGraph ( '' )"></p></form>
    <form action="" onsubmit="isThatAColor(this.elements[0].value); return false;" id="colorsel">
    </form>
    <div id="container"></div>
    </CENTER>
    <br style="clear:both;" />
    </body>
    </html>
    I cannot test the rest of the code so let me know if this help please.

    Thanks,
    JH*

  5. #5
    I'm New! ferrariboy21 is on a distinguished road ferrariboy21's Avatar
    Join Date
    June 10, 2008
    Location
    Liverpool lives in me
    Posts
    35
    Rep Power
    4
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    You're a Godsend JHalstead! Works like a Charm! One more thing. How do align the color and input field side to side? Eg.


    http://img528.imageshack.us/img528/1369/aa2zo8.jpg or http://xs231.xs.to/xs231/08392/aa2183.jpg.xs.jpg

    Reps+ added for you
    Last edited by ferrariboy21; Sep 23rd, 2008 at 1:47 am.

  6. #6
    Jedi Master JHalstead will become famous soon enoughJHalstead will become famous soon enoughJHalstead will become famous soon enough JHalstead's Avatar
    Join Date
    January 3, 2008
    Location
    OKC, OK - USA
    Posts
    147
    Rep Power
    5
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    Quote Originally Posted by ferrariboy21 View Post
    You're a Godsend JHalstead! Works like a Charm! One more thing. How do align the color and input field side to side? Eg.
    LOL, I wanted to do that yesterday but seeing that it was your code I didn't want to do anything you didn't ask for.

    If you want to do this yourself look into moving the isthatacolor form around the other inputs. I'm being a little vague because I don't know without testing myself if I'm telling you correctly and I don't want to give you bad information.

    I'll work things out on this side when I get a free minute today and get back with you.

    Code:
    <html>
    <head>
    <script src="201a.js" type="text/javascript"></script>
    
    <style type="text/css" media="screen">
    html, body {
    margin: 0;
    padding: 0;
    background: #8B8878;
    color: #fff;
    height: 99%;
    text-align: center;
    }
    
    #container {
    position: relative;
    width: 235px;
    margin: 7px auto;
    text-align: left;
    background: #8B8878;
    min-height: 99%; /* this is where inheritance stops */
    }
    
    /* if you remove this then the container disappears in IE */
    * html #container {
    height: 99%;
    } 
    
    #footer
    {
    position: absolute;
    bottom: 0;
    margin: 0 0 0 0;
    padding: 0 0 10px 0;
    height: auto;
    width: 760px;
    background: #4c4c4c;
    }
    
    #top-row
    {
    margin: 0 0 0 0;
    padding: 0 90px 60px 90px;
    width: 580px;
    color: #4c4c4c;
    }
    
    </style> 
    <script src="201a.js" type="text/javascript"></script>
    <script type="text/javascript">
    function ShowInputs()
    {
    	var idx=document.getElementById ( "menu1" ).selectedIndex-1;
    	var i=0;
    	var valuearray = new Array ();
    	for (i=0;i<=idx;i++) {
    		var inputid = "input"+i;
    		if ( document.getElementById ( inputid ) != null ) {
    			if ( document.getElementById ( inputid ).value != "" ) {
    				valuearray[i] = document.getElementById ( inputid ).value;
                }
    		} else valuearray[i] = "Fill in value";
    	}
            // reset container content before adding inputs
           document.getElementById('container').innerHTML = '';
    
    	for (i=0;i<=idx;i++)
    	{
    		document.getElementById('container').innerHTML += '<input type="text" id="input'+i+'" value="'+valuearray[i]+'"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div id="colorpicker201" class="colorpicker201"></div><input type="button" onclick="showColorGrid2(\'input_field_'+i+'\',\'sample_'+i+'\');" value="...">&nbsp;<input type="hidden" id="input_field_'+i+'" size="9" value="">&nbsp;<input type="text" id="sample_'+i+'" size="1" value="" /><br>';
    	}
    }
    
    </script>
    <div style="float:right; left:70%;">
    <TITLE>Our Final Year Project Assignment</TITLE>	
    	<style type="text/css">
    	<!--
    	body {
    		font-family: Arial, Helvetica, sans-serif;
    		font-size: 12px;
    	}
    	-->
    	</style>
    	<SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
    	<SCRIPT LANGUAGE="JavaScript">
    		//We store the XML data as a string
    		var strXML = "<graph animation='0' caption='Average Marks' showNames='1'><set name='Q1' value='72' color='AFD8F8'/><set name='Q2' value='72' color='AFD8F8'/><set name='Q3' value='72' color='AFD8F8'/><set name='Q4' value='72' color='AFD8F8'/><set name='Q5' value='72' color='AFD8F8'/><set name='Q6' value='72' color='AFD8F8'/><set name='Q7' value='72' color='AFD8F8'/><set name='Q8' value='72' color='AFD8F8'/><set name='Q9' value='72' color='AFD8F8'/><set name='Q10' value='72' color='AFD8F8'/></graph>";
    		var currentChartSWF;
    		/*
    		 * updateChart method is called, when user clicks the button
    		 * Here, we change the chart from Column to line
    		*/
    		function updateChart(chartSWF){
    			if ( chartSWF == undefined )
    				chartSWF = currentChartSWF;
    			//alert ( "chartSWF "+chartSWF+" currentChartSWF "+currentChartSWF );
    			//alert ( "strXML "+strXML );
    			//Create another instance of the chart.
    			var chart1 = new FusionCharts(chartSWF, "chart1Id", "500", "300", "0", "0");		   			
    			chart1.setDataXML(strXML);
    			chart1.render("chart1div");
    			currentChartSWF = chartSWF;
    		}
    		function generateGraph () {
    strXML = "<graph animation='0' caption='Average Marks' showNames='1'>";
    for ( i = 0; i < document.getElementById ( "menu1" ).value; i++ ) {
    	var inputid = "input"+i;
    	var inputfieldid = "input_field_"+i;
    	var colorid = "color"+i;
    	
        if ( document.getElementById( inputfieldid ).value != "" )
    			colorid = document.getElementById ( inputfieldid ).value;
    		else
    			colorid = "#AFD8F8";	
    
    	strXML += "<set name='Q"+(i+1)+"' value='"+document.getElementById ( inputid ).value+"' color='"+colorid+"'/>";	
    }
    strXML += "</graph>";
    			updateChart ();
    		}
    
    		function resetGraph () {
    			strXML = "<graph animation='0' caption='Average Marks' showNames='1'><set name='Q1' value='0' color='AFD8F8'/><set name='Q2' value='0' color='AFD8F8'/><set name='0' value='0' color='AFD8F8'/><set name='Q4' value='0' color='AFD8F8'/><set name='Q5' value='0' color='AFD8F8'/><set name='Q6' value='0' color='AFD8F8'/><set name='Q7' value='0' color='AFD8F8'/><set name='Q8' value='0' color='AFD8F8'/><set name='Q9' value='0' color='AFD8F8'/><set name='Q10' value='1' color='AFD8F8'/></graph>";
    			updateChart ();
    		}
    
    	</SCRIPT>
    </div>
    </head>
    <body>
    <div id="colorpicker201" class="colorpicker201"></div>
    <br>
    <br><br>
    <CENTER>
    
    		<h2>Our Final Year Project Assignment</h2>
    		
    		<div id="chart1div">
    			FusionCharts
    		</div>
    		<script language="JavaScript">					
    			var chart1 = new FusionCharts("../../FusionCharts/Frontpage.swf", "chart1Id", "500", "300", "0", "0");
    			chart1.setDataXML(strXML);
    			chart1.render("chart1div");
    		</script>
    		<BR />
    <div style="float:left; width:25%;">
    		<form name='frmUpdate'>
    		<b>Type of Graph</b><br>
    		<select name="mydropdown">
    		<option value='Column' onClick="javascript:updateChart('../../FusionCharts/Frontpage.swf');"></option>
    		<option value="Bar Graph" value='Column' onClick="javascript:updateChart('../../FusionCharts/FCF_Column3D.swf');" name='btnColumn' />Bar Graph</option>
    		<option value="Line Graph" value='Line' onClick="javascript:updateChart('../../FusionCharts/FCF_Line.swf');" name='btnLine' />Line Graph</option>
    		<option value="Pie Graph" value='Pie' onClick="javascript:updateChart('../../FusionCharts/FCF_Pie3D.swf');" name='btnPie' />Pie Graph</option>		
    		</select></form>
    <b>No of Inputs</b><br>
    <form name="form1">
      <select id="menu1" name="menu1" onChange="ShowInputs()">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
      </select>
    <form action="" onsubmit="isThatAColor(this.elements[0].value); return false;" id="colorsel">
    <div id="container"></div>
    </form>  
    	<p align='center'><input type="button" value="Generate Graph" onclick="javascript:generateGraph ( '' )"></p>
    	<p align='center'><input type="button" value="Reset Graph" onclick="javascript:resetGraph ( '' )"></p></form>
    <div id="container"></div>
    </CENTER>
    <br style="clear:both;" />
    </body>
    </html>
    This should be good to go. It looks like what you want but again I cannot test actual functionality so let me know if this works for you.

    Thanks,
    JH*
    Last edited by JHalstead; Sep 23rd, 2008 at 6:37 am.

  7. #7
    I'm New! ferrariboy21 is on a distinguished road ferrariboy21's Avatar
    Join Date
    June 10, 2008
    Location
    Liverpool lives in me
    Posts
    35
    Rep Power
    4
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    Works perfect mate! It looks like I can't click "Thank" on your post, but thanks once again buddy.

    This is for a school project and I'm still reading and learning about it. It's kinda hard hhaha .. I'm working on how to change those "Q1, Q2, Q# (See Link) so that the user can fill in their own title. What do you suggest I do mate?

    If you need any help (not programming related that is!), feel free to PM me.

  8. #8
    Jedi Master JHalstead will become famous soon enoughJHalstead will become famous soon enoughJHalstead will become famous soon enough JHalstead's Avatar
    Join Date
    January 3, 2008
    Location
    OKC, OK - USA
    Posts
    147
    Rep Power
    5
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    Quote Originally Posted by ferrariboy21 View Post
    This is for a school project and I'm still reading and learning about it. It's kinda hard hhaha .. I'm working on how to change those "Q1, Q2, Q#"...
    Well since this is a school project I'll quit doing it for you Hopefully you have been reading my changes and understand what I was doing.

    1. I would recommend creating new inputs for the name of each line using the for loop (on line 67). Just give the new input box a unique name using same method as other boxes.

    1a. You could also edit the for loop (on line 56) to save the name value like it is doing for the bar value. But this step is not required to do what you asked, just more professional.

    2. After you have these new boxes setup, create a new variable to read from the new boxes you created. (similar to the ones on line 107-109)

    3. And finely edit the "strXML" code (on line 116) and change the 'name' attribute to read the variable you created in step 2.

    This edit is nothing new just more of the same as already being done so you should be able to accomplish this with a little effort. If you have any issues feel free to let me know how it goes.

    Thanks,
    JH*
    Last edited by JHalstead; Sep 23rd, 2008 at 3:00 pm.

  9. #9
    I'm New! ferrariboy21 is on a distinguished road ferrariboy21's Avatar
    Join Date
    June 10, 2008
    Location
    Liverpool lives in me
    Posts
    35
    Rep Power
    4
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    Cheers mate, you're instructions are as clear as crystal! I'll get working on it.

    ferrariboy21 added 1152 Minutes and 17 Seconds later...

    1. I would recommend creating new inputs for the name of each line using the for loop (on line 67). Just give the new input box a unique name using same method as other boxes.
    Code:
    for (i=0;i<=idx;i++)
    	{
    		document.getElementById('container').innerHTML += '<input type="text" id="input'+i+'" value="'+valuearray[i]+'"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div id="colorpicker201" class="colorpicker201"></div><input type="button" onclick="showColorGrid2(\'input_field_'+i+'\',\'sample_'+i+'\');" value="...">&nbsp;<input type="hidden" id="input_field_'+i+'" size="9" value="">&nbsp;<input type="text" id="sample_'+i+'" size="1" value="" /><input type="text" id="axis_'+i+'" size="3" value="" /><br>';
    	}
    2. After you have these new boxes setup, create a new variable to read from the new boxes you created. (similar to the ones on line 107-109)
    Code:
    var axisid = "axis"+i;
    3. And finely edit the "strXML" code (on line 116) and change the 'name' attribute to read the variable you created in step 2.
    Code:
    strXML += "<set name='"+document.getElementById ( axisid ).value+"' value='"+document.getElementById ( inputid ).value+"' color='"+colorid+"'/>";
    Is it right mate It works for me, but is it neat? And I can;t seem to put the input box next to each other? ()

    (I thought I couldn't do this, but your steps was really simple for me to follow!)
    Last edited by ferrariboy21; Sep 24th, 2008 at 4:11 pm. Reason: Automerged Doublepost

  10. #10
    Jedi Master JHalstead will become famous soon enoughJHalstead will become famous soon enoughJHalstead will become famous soon enough JHalstead's Avatar
    Join Date
    January 3, 2008
    Location
    OKC, OK - USA
    Posts
    147
    Rep Power
    5
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    Looks right to me, as for placing boxes next to each other. Look at the CSS for "#container" make it wider to accommodate the new box.

  11. #11
    I'm New! ferrariboy21 is on a distinguished road ferrariboy21's Avatar
    Join Date
    June 10, 2008
    Location
    Liverpool lives in me
    Posts
    35
    Rep Power
    4
    Feedback Score
    0

    Default Re: document.getElementById - Help needed

    Thanks alot JH. Works perfect now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Ad rotator needed
    By Ardit in forum HTML & Website Design
    Replies: 13
    Last Post: Oct 30th, 2008, 3:50 am
  2. Shop Needed
    By Rhiannon in forum Social Networks
    Replies: 19
    Last Post: Oct 29th, 2008, 10:02 pm
  3. Support needed
    By webster13045 in forum Forum Lounge
    Replies: 2
    Last Post: Mar 6th, 2008, 10:47 am
  4. CSS help needed
    By Autumn in forum HTML & Website Design
    Replies: 14
    Last Post: Dec 16th, 2007, 6:06 pm
  5. what do you think? a little help needed here
    By ashish in forum Computers and Electronics
    Replies: 4
    Last Post: Oct 12th, 2004, 4:18 pm

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
WebTalkForums
WebTalkForums
Recent Forum Threads