iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old May 17th, 2009, 03:36 AM   #1
New Member
 

Join Date: Aug 2008
Location: kuwait
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 andylonger is on a distinguished road
Exclamation selected is null or not an object

Good day everybody i have issue with my script and it gives me an error selected is a null or not an object im using IE 6 can any one check this for me ..

error on Lines128 and 155
Code:
<?
    include('config.php');
    include('connect.php');
    include('checkusersession.php');
    if (!isset($target_type))
        $target_type = 'all';    
?>
<form  name='form_allocate_terminals'>
<table  border="0" cellpadding="4" cellspacing="4" width="50%" align="center" class="tableForm">
 <tr >
         
        <td align="left" valign="middle" width="3%" >                        
            <font color="#000000"><strong>Type:</strong></font>       
        </td>
        <td align="left" valign="middle"   colspan="5">
           <select name="message" >
            <?
                $sqlMsg = "SELECT * FROM `".$DBTablesPrefix."_emergency_type`";
                $Infos = mysql_query($sqlMsg) or die("Query Failed 1");
                $j = 0; 
                while($Row_Infos = mysql_fetch_assoc($Infos)) 
            {
                $j++;
                $Id = $Row_Infos['Id'];
                $name = $Row_Infos['name'];
                echo "<option value='".$Id."' ".$strSelected.">".$name;
            }
            ?>
           </select>            
        </td>
  </tr>    
  <tr bgcolor="#ECECEC" >
            <td align="left" valign="middle" width="3%" colspan="4">
            <input type="radio" name="target_type" value="all" <?=($target_type=="all")?"checked":""?> onClick="disableItems(this);">
            <font color="#000000" size="2"><strong>All</strong></font>
        </td>    
   </tr>   
   <tr bgcolor="#ECECEC">
            <td align="left" valign="middle" width="3%" colspan="4">
            <input type="radio" name="target_type" value="room" <?=($target_type=="room")?"checked":""?> onClick="disableItems(this);">
            <font color="#000000" size="2"><strong>Rooms</strong></font>
        </td> 
    </tr>
    <tr >
         <td align="left" valign="middle" width="30%">
          <select name="target_list[]" id ='target_list' size="3" multiple style="width:100 ">
            <?
                    //terminal identification in multi-terminal rooms
                $query ="SELECT IP, Room FROM `".$DBTablesPrefix."_stbs`"."WHERE Version='aminet110' "." ORDER BY Room ";
                 $Infos = mysql_query($query) or die("Query failed on line 188");
                $i = 0;
                while($Row_Infos = mysql_fetch_array($Infos))
                    {
                    $i++;
                    $IP     = $Row_Infos['IP'];
                    $Room     = $Row_Infos['Room'];                        
                    $messRoom = Room; 
                    //echo "<option value='".$Room[$i]."' ".$strSelected.">".$Room."::".$IP."\r\n";
                  echo "<option value='".$Room[$i]."' ".$strSelected.">$messRoom ".$Room." \r\n";
                    }
             ?>
          </select>
</td>
        <td  width="10%" align="center" valign="middle">
            <input type="hidden" name="action" value="add">
             <table  border="0">                 
                <tr align="center" height="50%">
                      <td width="30%">
                        <?
                        echo '<img src="../admin/img/right.gif"  border="0"><img src="../admin/img/right.gif"  border="0">';
                        ?>
                     </td>
                     <td>
                    
                    <input type="button" onClick='movein()' value="Add">
                    
                     </td>
                    <td width="30%">
                    <?
                     echo '<img src="../admin/img/right.gif"  border="0"><img src="../admin/img/right.gif"  border="0">';
                     ?>                                                                
                    </td>
               </tr>
                 <tr align="center" height="50%">
                    <td width="30%">
                        <?
                            echo '<img src="../admin/img/left.gif"  border="0"><img src="../admin/img/left.gif"  border="0">';
                        ?>
                    </td>
                    <td>
                    <input type="button" onClick="moveout()" value="Remove">
                    </td>
                    <td width="30%"><? echo '<img src="../admin/img/left.gif"  border="0"><img src="../admin/img/left.gif"  border="0">';?>
                    </td>                                                                
                 </tr>
          </table>                           
      </td>
        
          <td align="right" width="30%">
           <select name="allocatedTerminals[]" id='allocatedTerminals' size="3" multiple style="width:100 " >                    
        
            </select>
      </td>
 </tr>
  <tr align="center" >
    <td colspan="4"><input type="button" name='btnSend' value="Send" onClick="sendemergency(form_allocate_terminals)">
     <!-- <input name="btnsend"  type="button" class="buttform" id="34" value="Send Emergency" onclick="pushpage()" />--></td>
  </tr>                                                        
 </table>                                   
</form>
<script language="javascript">
var cmdLink = "EMERGENCY_execcommand.php?Emergency=<?php echo $name;?>&targetType=<?php echo $target_type;?>&ip=<?php echo $IP;?>";
function pushpage()
{
    Link = cmdLink+" SEND";
    //alert(Link);
    var msg = "Are you sure you want to delcare Emergency?";
    if(confirm(msg))
        document.location.href=""+Link;
}
function movein()
{
    var target_list = document.getElementById('target_list');;
    var allocated_terminal = document.getElementById('allocatedTerminals');
    var target_list_length = target_list.length;
    for(var j=0; j<target_list_length; j++)
    {
        if(target_list[j].selected)    //this is where im getting error msg 
        {
            var tmp = target_list.options[j].text;
            var tmp1 = target_list.options[j].value;
            target_list.remove(j);
            j--;
            var y=document.createElement('option');
            y.text=tmp;
            try
            {
            allocated_terminal.add(y,null);
            }
            catch(ex)
            {
            allocated_terminal.add(y);
            }
        }
    }
}

function moveout()
{
    var target_list = document.getElementById('target_list');
    var allocated_terminal = document.getElementById('allocatedTerminals');
    var allocated_terminal_length = allocated_terminal.length;
    for(var j=0; j<allocated_terminal_length; j++)
    {
        if(allocated_terminal[j].selected)    //this is where im getting error msg 
        {
            var tmp = allocated_terminal.options[j].text;
            var tmp1 = allocated_terminal.options[j].value;
            allocated_terminal.remove(j);
            j--;
            var y=document.createElement('option');
            y.text=tmp;
            try
            {
            target_list.add(y,null);
            }
            catch(ex)
            {
            target_list.add(y);    
            }

        }
    }    
}

function disableItems(selectedItem)
 {
    if (selectedItem.value =='all')
        {
              document.getElementById("target_list").disabled = true;
            document.getElementById("allocatedTerminals").disabled = true;
                    
        }
    else  if(selectedItem.value =='room')
        {
            document.getElementById("target_list").disabled = false;        
            document.getElementById("allocatedTerminals").disabled = false;
            
        }            
 }
window.onload=function()
 {
    var targetType = '<? echo $target_type;?>';
    if (targetType =='all')
        {
            document.getElementById("target_list").disabled = true;
            document.getElementById("allocatedTerminals").disabled = true;
                    
        }
    else  if(targetType =='room')
        {
            document.getElementById("target_list").disabled = false;        
            document.getElementById("allocatedTerminals").disabled = false;
            
        }        
 }    
 

function sendemergency()
{
var len =document.form_allocate_terminals.target_type.length;
for (i=0;i<len;i++)
{
if(document.form_allocate_terminals.target_type.checked)
 {
 alert("Do you really want to send the emergency");
 }
}
}
</script>
<?php

    $action =send;     
    if ($btnSend ==$action)
    {
        $pause = 5;
        $sqlMsg = "SELECT * FROM `".$DBTablesPrefix."_emergency_type`";
        $Infos = mysql_query($sqlMsg) or die("Query failed on line 55");
        $j = 0;
        while($Row_Infos = mysql_fetch_assoc($Infos))
        {    
            $j++;
            $Id= $Row_Infos['Id'];
            $msg= $Row_Infos['message'];
            if ($Id == $message)
            {
                $display_message = $msg;
            }    
        }
        $commandURL = "../emergency/simple_remote_control.php?message=".urlencode(stripslashes($display_message));
        $cmdOptions = "/PASSWORD \"".$aminoRemoteControlPassPhrase."\" /TIMEOUT 12 /THREADS 60 /PAUSE ".$pause." /QUIET";
        $cmdCommand = "/LOADURL ".EMERGENCY_PATH."simple_emergency_message.php"."?message=".urlencode(stripslashes($display_message));
        $cmdFile = "/FILE \"".$tIpListFiles[$TERM_TYPE_AMINET100][0]."\"";    
        if ($target_type == 'all')    
        {
            $sqlTerminals =    "SELECT IP, Room FROM `".$DBTablesPrefix."_stbs`"." 
            WHERE Version='AMINET110'  "."ORDER BY (Room+0)";
            $Infos = mysql_query($sqlTerminals) or die("Query failed on line 78");
            $i = 0;
            while($Row_Infos = mysql_fetch_assoc($Infos))
            {
                $i++;
                $termIP     = $Row_Infos['IP'];
                $termRoom     = $Row_Infos['Room'];    
                $cmdLine     = "AminoBatchControl.exe ".$cmdCommand." ".$cmdOptions." ".' TERMINALCHANGE '.$termIP;
                exec( $cmdLine, $cmdOutput);
            }    
        }
        
        else if ($target_type == 'room')    
        {
            for ($i = 0; $i< count($Room); $i++)
            {
                $sqlTerminals =    "SELECT IP, Room FROM `".$DBTablesPrefix."_stbs` ". "WHERE `Room` = '$Room[$i]'";        
                $Infos = mysql_query($sqlTerminals) or die("Query failed in line 95");
                   if ($sqlTerminals > 0)
                while($Row_Infos = mysql_fetch_assoc($Infos))
                {
                    $IP_terminal     = $Row_Infos['IP'];                
                    $cmdLine = "AminoBatchControl.exe ".$cmdCommand." ".$cmdOptions." ".' TERMINALCHANGE '.$IP_terminal;
                    //echo $cmdLine;
                    exec( $cmdLine, $cmdOutput );
                }
            }        
        }
    }
?>
thanks is advance
andylonger is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
A nonexistent window - is it null, udefined, or what? ruffy JavaScript 3 November 22nd, 2008 11:20 PM
Why is my document found to be null? ruffy JavaScript 4 July 17th, 2008 05:42 PM
[SOLVED] Column 'photo' cannot be null longstand PHP 7 December 1st, 2007 12:08 PM
How to view selected field only? awiezzz Classic ASP 1 May 13th, 2007 01:12 PM
How to get value of selected dynamic checkboxes? frmsasp .NET 1 November 3rd, 2005 09:59 AM


Search Engine Optimization by vBSEO 3.2.0 RC8