Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't access the value but with ALERT before it works..

Status
Not open for further replies.

ETN

Programmer
Jan 27, 2004
33
CA
Hi all,

I have a strange problem, my script doesn't work but in testing i saw that putting an alert in my code makes the script to work.. but i don't want to have an alert!!

I have an embed window media video and i want to get the markers from it in javascript to populate a SELECT list. So I copied the code from MSDN:

As you can see in my code if I insert an alert box, it works (my list is populated), else i have an empty list.. I don't understand why.. is it because it's clearing the buffer or something? Is there an alternative way I can do (I don't want an alert), i've tryed creating a cookie it doesn't work.. I know the code for the embed I took from Microsoft is working. It's really a strange Javascript error.. never seen that before.

Here is the code:

Code:
<SELECT ID = "markers"  NAME = "markers"  LANGUAGE = "JScript"

        /* Seek to the marker number that corresponds to the SELECT element
           selectedIndex value when the list selection changes. */
        onChange = "Player.controls.currentMarker = markers.selectedIndex + 1;
        ">


  <script language="JScript">

[COLOR=green][b]
alert("why when i pop an alert it works but when none it does'nt work?");[/b]
[/color]

// Get the number of markers in the current media item.
var mcount = Player.currentMedia.markerCount;

// Verify that at least one marker exists in the current media item.
if (mcount > 0){

// Loop through the marker list.
for (var i = 1; i < mcount + 1; i++){
			   document.write("<OPTION>" + Player.currentMedia.getMarkerName(i) + "</OPTION>");
				}
			}	  		  
		  </script>
</SELECT>

Thanks
 
An interesting thing I can add, is that if i take off my alert message, and I make one just after the: var mcount = Player.currentMedia.markerCount; . The value is 0, but when i keep my alert message and make one after the var mcount = Player.currentMedia.markerCount; , the value is 8...

I'm confused :-\
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top