Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
document.getElementById(Title[Column]).value = "test";
Old 04-02-2009, 08:25 PM document.getElementById(Title[Column]).value = "test";
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
This is my code:


Code:
 
<?php
require_once('../Connections/Hawks.php');
mysql_select_db($database, $Hawks);
$ColumnTitles = mysql_query("Show Columns From Clients");
$RecordValues = mysql_query("Select * From Clients");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script type="text/javascript"
 src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=A4n80DTV34GBP2hnFN5HjI9A9FlAUeOR2VCyqVNL6dJr2wt86R1aRUy59b2rTvXmGA">  
</script>
<script type="text/javascript">
var ReqStr;
var LastVisit = new Array();
var Title = new Array();
var Columns;
var Column;
var Records;
var Record;
<?php
  $Records = 0;//Set number of records = 0
  $Columns = 0;//Set number of columns = 0
  $Var = array();
  $Column = 0;//Set column pointer = 0
  $Record = 0;//Set $Record pointer = 0
  echo "\r";
  while ($Title = mysql_fetch_assoc($ColumnTitles))
   {
   echo "var ".$Title[Field]." = new Array();\n";//create array for each column
   $Var[$Columns] = "$Title[Field]";
   echo "Title[$Columns] = '".$Var[$Columns]."'\n";
   $Columns = $Columns+1;//collect column count
   }
  echo "\n";
  while ($Data = mysql_fetch_array($RecordValues))
   {
    //$LastVisit = mysql_query("Select Date From invoices where ClientID=$Data('ClientID') Order By Date Desc Limit 0,1"); 
    $Column = 0;//Set column pointer = 0
    while ($Column < $Columns)
     { 
      echo $Var[$Column]."[".$Record."] = '".$Data[$Column]."'\n";
      $Column = $Column+1;
     }
    //echo "LastVisit($Record) = $LastVisit";
    $Record = $Record+1;
   }
  echo "Columns = $Columns\n";
  echo "Column = 0\n";
  echo "Records = $Record\n";
  echo "Record = 0\n";
?>
Column = 0 
function SetValues()
{
 while (Column <= Columns)
  {
   alert(Title[Column]);
   document.getElementById(Title[Column]).value = "Test";
   Column = Coloumn+1;
  }
 GetMap();
}
 
function GetMap()
 { 
  var Location =  document.getElementById("Address").value + " " + document.getElementById("City").value + "," + document.getElementById("ST").value;
  if(Location)
   {
    // Create a map object   
    var map = new YMap(document.getElementById('map'));   
 
    // Add map zoom (long) control   
    map.addZoomLong();   
 
    // Add the Pan Control   
    map.addPanControl();   
    // Add map type control   
    map.addTypeControl();
 
    //Add marker
    map.addMarker(Location);
 
    // Set map type to either of: YAHOO_MAP_SAT, YAHOO_MAP_HYB, YAHOO_MAP_REG   
    map.setMapType(YAHOO_MAP_REG);   
 
    // Display the map centered on a geocoded location   
    map.drawZoomAndCenter(Location, 3);
   }
  return;    
 }
 
function Navigate(Button)
 {
  switch(Button)
   {
    case "First":
      if (Record > 0)
       {
        Record = 0;
        SetValues();
       }
      break;
    case "Previous":
      if (Record > 0)
       {
        Record = Record - 1;
        SetValues();
       }
      break;
    case "Next":
      if (Record < Records-1)
       {
        Record = Record + 1;
        SetValues();
       }
      break;
    case "Last":
      if (Record < Records-1)
       {
        Record = Records-1;
        SetValues();
       }
      break;
   }
  SetValues()
 }
</script> 
<style type="text/css">  
#map{
 border: thin solid #aaaaaa;
 width: 300px;
 display: block;
 overflow: hidden;
 height: 300px;
} 
    .style1 {
 color: #FF0000;
 font-weight: bold;
 font-style: italic;
}
    #main {
}
    .style2 {
 font-size: large;
 font-weight: bold;
 font-style: italic;
}
    .style3 {color: #FFFFCC}
    #main #form {
 width: 0px;
 border-style: inset;
 text-align: center;
 background-attachment: fixed;
}
    .style4 {font-size: large}
    #main #controls {
 border-top-width: thin;
 border-right-width: thin;
 border-bottom-width: thin;
 border-left-width: thin;
 border-top-style: outset;
 border-right-style: outset;
 border-bottom-style: outset;
 border-left-style: outset;
 width: 0px;
}
body {
 background-repeat: repeat;
 background-image: url(../Images/logo.png);
}
.style6 {
 font-family: "Century Gothic";
 font-weight: bold;
 font-style: italic;
 font-size: xx-large;
}
.style8 {font-size: small}
</style> 
</head>
<body onLoad="SetValues()">
  <div id="main" align="center"><span class="style6">Hawks</span>
  <form name="Clients" action="">
  <p>&nbsp;</p>
  <p><span class="style2">Clients</span></p>
  <div id="form" align="center">
   <table border="0" cellspacing="1"  bgcolor="#00FFFF">
    <tr>
     <td  nowrap colspan="2" align="left"><div align="left" class="style1">
       <div align="center" class="style4"><?php echo urldecode($ClientID) ?>
         <div class="style8"><strong> Last Visit:<?php echo urldecode($Cycle) ?> </strong></div>
     </div></td>
     <td rowspan="9"><div id="map" align="center"></div></td>
    </tr>
    <tr>
     <td  nowrap align="left"><strong>Store Name: </strong></td>
     <td  nowrap align="right"><div align="left">
       <input size="32" type="text" id="StoreName" name="StoreName" value="">
     </div></td>
    </tr>
    <tr>
     <td nowrap align="left"><strong>Address:</strong></td>
     <td nowrap align="right"><div align="left">
       <input size="32" type="text" id="Address" name="Address" value="" onKeyup="GetMap()">
     </div></td>
    </tr>
    <tr>
     <td nowrap align="left"><strong>City:</strong></td>
     <td align="right" nowrap><div align="left">
       <input size="13" type="text" id="City" name="City" onKeyup="GetMap()" value="" maxlength="32">
       <input size="1" type="text" id="ST" name="ST" maxlength="2" onKeyUp="GetMap()" value="">
       <input size="5" type="text" id="Zip" name="Zip" value="">
     </div></td>
    </tr>
    <tr>      </tr>
    <tr>
     <td nowrap align="left"><strong>Manager(s):</strong></td>
     <td nowrap align="right"><div align="left">
       <input size="32" type="text" id="Manager" name="Manager" value="">
     </div></td>
    </tr>
    <tr>
     <td nowrap align="left"><strong>Phone:</strong></td>
     <td nowrap><div align="left">
       <input size="14" type="text" id="Phone" name="Phone" value="">
       <strong>Ext:</strong>
      <input size="6" type="text" id="Ext" name="Ext" value="">
     </div></td>
    </tr>
    <tr>
     <td nowrap align="left"><strong>Cell / Other:</strong></td>
     <td nowrap><div align="left">
       <input size="32" type="text" id="Cell" name="Cell" value="">
     </div></td>
    </tr>
    <tr>
     <td colspan="2" align="left" nowrap><div align="center"><strong>Notes:</strong>
     </div>
      <div align="center">         
       <textarea id="Notes" name="Notes" rows="3" cols="32"></textarea>
     </div></td>
    </tr>
   </table>
  </div>
  <div id="Message"></div>
  <div align="center">
  <div id="controls">
   <table border="1" cellpadding="2" cellspacing="3">
    <td nowrap height="39" bgcolor="#00FF00">
       <input title="First Record" type="button" value="|<" name="First" onClick="Navigate(this.name)">
       <input title="Previous Record" type="button" value="<" name="Previous" onClick="Navigate(this.name)">
       <input title="Next Record" type="button" value=">" name="Next" onClick="Navigate(this.name)">
       <input title="Last Record" type="button" value=">|" name="Last" onClick="Navigate(this.name)">  </td>
    <td nowrap bgcolor="#00FF00">
       <input title="New Record" type="button" value="*" name="New" onClick="Handler(this.name,'Create new record?')">
       <input title="Sort by current field" type="button" value="!" id="Sort" name="Sort" onClick="Handler(this.name,'')">  </td>
    <td nowrap bgcolor="#FF0000" class="style3">
       <input title="Save Record" type="button" value="Save" name="Save" onClick="Handler(this.name,'Save this record?')">
       <input title="Delete Record" type="button" value="Delete" name="Delete" onClick="Handler(this.name,'')">  </td>
    <td nowrap bgcolor="#CCCCCC" class="style3">
       <input title="Return to Main Menu" type="button" value="Done" name="Done" onClick="Handler(this.name,'')">
       <input title="Clear Form" type="button" value="Clear" name="Clear" onClick="Handler(this.name,'')">  </td>
   </table>
   </div>
   </div>
  </form>
</div>
</body>
</html>


The problem is in the area highlighted in RED, while the alert displays 'ClientID' the getElementById(Title[Column]).value = "test" is not working...

Anybody know what is up?
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-02-2009, 10:01 PM Re: document.getElementById(Title[Column]).value = "test";
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
What do you get if you alert:
Code:
document.getElementById(Title[Column])
?
logic ali is offline
Reply With Quote
View Public Profile
 
Old 04-04-2009, 08:52 PM Re: document.getElementById(Title[Column]).value = "test";
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
The alert returns null, I believe the double quotes are being removed in parsing the line.
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to document.getElementById(Title[Column]).value = "test";
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25432 seconds with 12 queries