Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

TEG

macrumors 604
Jan 21, 2002
6,621
169
Langley, Washington
Works fine for me in OSX-Safari. I don't have any OS9 Browsers to try, but I believe the problem is with your client's machine. Maybe they have an older Browser with out the right JavaScript (No Relation to Java™). Have them update their Safari, or Mozilla Builds to the newest ones available.

TEG
 

Blackheart

macrumors 6502a
Mar 13, 2004
938
0
Seattle
For me, it works on Safari (version 1.2.1), Firefox (version .8/ Mozilla 5.0) but will not work on IE (version 5.2).
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
I've just tested it in 9 browsers on Mac OS X. Here's the results:

Works perfectly in Safari 1.2.1, Netscape 7.1, Firefox 0.8, Mozilla 1.4, Omniweb 3.5 and TrailBlazer 0.5.
Script works in iCab 2.9.7, but it's not displayed properly.
Script works in Opera 6.02, but the columns are not redrawn (eg an item does actually move, but the user can't see that this has happened).
Script doesn't work in IE 5.2.3.

I'd suggest validating the site at http://validator.w3.org/. Sites that validate are generally much more consistent between browsers and usually display as expected.
 

Westside guy

macrumors 603
Oct 15, 2003
6,340
4,158
The soggy side of the Pacific NW
It's probably worth noting that Internet Explorer on the Mac hasn't been developed for a couple years - so any fixes Microsoft has put into their Windows browser have not made it to the Mac version (and won't, ever).
 

game_on

macrumors newbie
Original poster
Apr 11, 2004
6
0
Hi, cheers everyone. I have used that validator - great stuff. Does it work in IE MAc now?

M@)
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
No it still doesn't. I did I bit of debugging and found that the line 'index.push(i);' is the culprit. I did some quick research and apparently IE for Mac has a version of Javascript that is too old to use this method. You may have to find some alternative code.
 

game_on

macrumors newbie
Original poster
Apr 11, 2004
6
0
This 'should' now work on MAC ie as a result of:

Code:
   if (![].push) Array.prototype.push = ArrayPush;
   function ArrayPush()
   {
       this[this.length] = arguments[0];
       return(this.length);
   }


Does it?
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
No, but if you replace 'index.push(i)' with 'index[index.length]=i' it does. However, the new code no longer works in Netscape, Mozilla, Firefox, Opera and iCab (and probably Camino). It deleted an item from the list, but doesn't add it to the new one. :confused:
 

game_on

macrumors newbie
Original poster
Apr 11, 2004
6
0
Hi HexMonkey, thanks for the advice, and thank you for helping a mac less person.

I have adjusted the code to:

Code:
<script type="text/javascript" language="JavaScript">
   function moveOption(sourceSelect, targetSelect)
   {
       var index = new Array();
   
       for (var i = 0; i < sourceSelect.options.length; i++) {
           if (sourceSelect.options[i].selected)
           index[index.length]=i;
       }
   
       if (index.length == 0) {
           alert("Please select at least one item to move");
           return;
       }
   
       while(index.length != 0) {
           var i = index.pop();
           var option = sourceSelect.options[i];
           var temp = new Option(option.text, option.value);
           sourceSelect.options[i] = null;
           targetSelect.add(temp);
       }
   }

</script>

Do it work in MAC IE now?
http://www.3ainteractive.com/temp/mactest2.cfm

M@)
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
I discovered that it wasn't the pop code that was causing the problem in Firefox, Netscape etc, it was something else (I'm not sure what). But by modifying the original file (which I had saved to disk), I got the script working in all my browsers (except the display problems in iCab and Opera which were always there). Here is the page's code in its entirity:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

   
<script type="text/javascript" language="JavaScript">
   if (![].pop) Array.prototype.pop = ArrayPop;

   function ArrayPop()
   {
    var tempItem = this[this.length-1];
    this.length--;
    return(tempItem);
   }

   function moveOption(sourceSelect, targetSelect)
   {
      var index = new Array()
      for (var i = 0; i < sourceSelect.options.length; i++)
      {
         if (sourceSelect.options[i].selected)
         {
	     index[index.length]=i;
         }
      }

      if (index.length == 0) 
      {
       alert("Please select at least one item to move");
       return;
      }

      while(index.length != 0)
      {
	var i = index.pop();
         var option = sourceSelect.options[i]
         var temp = new Option(option.text, option.value)
         sourceSelect.options[i] = null
         targetSelect.options[targetSelect.options.length] = temp
      }
      
   }

   function SelectAllOf(){
      s=document.AssignPlayer.TeamPlayerList;
      for(var i=0;i<s.options.length;i++){
         s.options[i].selected=true;
      }
      t=document.AssignPlayer.AvPlayerList;
      for(var i=0;i<t.options.length;i++){
         t.options[i].selected=true;
      }      

   }
   
   function ClearThem(){
      s=document.AssignPlayer.TeamPlayerList;
      for(var i=0;i<s.options.length;i++){
         s.options[i] = null;
      }
      t=document.AssignPlayer.AvPlayerList;
      for(var i=0;i<t.options.length;i++){
         t.options[i] = null;
      }           
   }
   
	function setStyle(obj,style,value){
		getRef(obj).style[style]= value;
	}
	
	function getRef(obj){
		return (typeof obj == "string") ?
			 document.getElementById(obj) : obj;
	}
</script>   
   
</head>

<body>

Trying to get this worhking on Mozilla/4.0 (compatible; MSIE 5.16; Mac_PowerPC).<br> <br>
It does not work on Does not work on IE 5.2.  I am trying to find out what I could change in the JS to make it work?<br> <br>

<form name="AssignPlayer" action="post">
<table width="50" border="0" cellpadding="0" cellspacing="0">
   <tr>
      <td>
         <input tabindex="5" name="backtolib" type="button" onclick="moveOption(document.AssignPlayer.TeamPlayerList, document.AssignPlayer.AvPlayerList)" value="REMOVE PLAYERS >>" class="button" style="width:270px;"><br>
         <select name="TeamPlayerList" class="form_input" size="2" multiple style="width:270px;">
               <option value="1">One</option>
         </select>                             
         <input tabindex="7" name="backtolib" type="button" onclick="moveOption(document.AssignPlayer.TeamPlayerList, document.AssignPlayer.AvPlayerList)" value="REMOVE PLAYERS >>" class="button" style="width:270px;">
      </td>
      <td>
         <input tabindex="6"  name="addtot" type="button" onclick="moveOption(document.AssignPlayer.AvPlayerList, document.AssignPlayer.TeamPlayerList);" value="<< ADD PLAYERS" class="button" style="width:270px;"><br>                                                  
         <select name="AvPlayerList" class="form_input" size="2" multiple style="width:270px">
               <option value="2">Two</option>                                            
         </select>   
         <input tabindex="8"  name="addtot" type="button" onclick="moveOption(document.AssignPlayer.AvPlayerList, document.AssignPlayer.TeamPlayerList);" value="<< ADD PLAYERS" class="button" style="width:270px;">                             
      </td>                                 
  </tr>
</table>  
 </form>
</body>
</html>
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
game_on said:
It definately works in IE5.2 on your MAC (OX9 and OSX)?

Yes, the script works in IE 5.2.3 for Mac OS X, IE 5.0 for Mac OS 9, and 9 other OS X browsers (including Camino, which I just downloaded).
 

game_on

macrumors newbie
Original poster
Apr 11, 2004
6
0
Hail HexMonkey!!

Message for you.

Code:
436865657273206D6174652E20205468616E6B20796F7520736F6F206D7563682E2020596F7520617265206163652100
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.