Hello and thanks for reading my question. I'll warn you, it will probably seem dull to most of you, but I just can't get it working.

It's about a chrome extension I'm trying to write for my audio stream. Here's what I'm trying to do:

A small icon, that when is clicked once starts playing music, and when is clicked again stops, and so on...

Here's what I've tried:

&lt;!doctype html&gt;

&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script src="popup.js"&gt;&lt;/script&gt;
&lt;div id="music"&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


and popup.js

var well=0
//Executed when the extension's icon is clicked
chrome.browserAction.onClicked.addListener(function(tab) 
{ 
    if(well&gt;0)
    {
        var well=0;
        document.getElementById('music').innerHTML= '&lt;iframe src="#" width="100" height="100"&gt;&lt;/iframe&gt;';
    }
    else
    {
        var well=1;
        document.getElementById('music').innerHTML= '&lt;iframe src="http://electro.piratefm.ro/popup.html" width="100" height="100"&gt;&lt;/iframe&gt;';
    }
});


What's happening is that when the extension is loaded, no music plays. When you click it, it starts playing and everything's fine. When you click it again, it stops for a couple of seconds then starts playing again. I need it to stop until you click it again.

Thanks for reading and sorry if it's already been asked or if it's dull.


Question: How do I know if which leg is the emitter or the collector? (Transistor)
Answer: Set meter to lowish ohms range so a diode conduction can be seen - trial and error OR diode test if available.


With an NPN transistor the base will have two diodes facing away from it. ie with most positive meter lead on the base the other two leads will show a conducting diode when the negative lead is placed on them
With a PNP  transistor the base will have two diodes facing towards it. ie with most positive negative (usually black) meter lead on the base the other two leads wil show a conducting diode when the positive  lead is placed on them


OK - now you know NPN from PNP and which is base. Now


Connect positive to guessed collector for NPN and negative to guessed emitter. Set meter to 1 megohm plus range.

-Connect base to guessed collector via a high value resistor - probably 100k to 1M. A wet finger works well. Note reading.


Now swap guessed emitter and collector and repeat. Again resistor is added from base to guessed collector. Note reading



One of the two above will have a much lower R_CE reading when base is forward biased. That's the correct guess. 

Once you get used to this you can pick up a leaded transistor, juggle it with meter leads till you find the two diodes giving base and NPN or PNP then lick your finger and do a forward bias base test - and then declare pinout. Looks like magic to many. Works.

You can or course formalize that on a breadboard and even add (gasp) switches to swap polarity etc. 

Note that you can get some idea of Beta (current gain _ from this once you learn to calibrate your wet finger.