snipt

Ctrl+h for KB shortcuts

ActionScript 3

FF3 - OSX - JS

var urlReq:URLRequest = new URLRequest("javascript:*your function*();");
navigateToURL( urlReq , "_self" );
https://snipt.net/embed/b3ed962c1df36ae5fa2fb0caa6638c97/
/raw/b3ed962c1df36ae5fa2fb0caa6638c97/
b3ed962c1df36ae5fa2fb0caa6638c97
as3
ActionScript 3
2
2019-08-22T11:04:38
True
False
False
/api/public/snipt/2648/
ff3-osx-js
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">var</span> <span class="n">urlReq</span><span class="p">:</span><span class="kt">URLRequest</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">URLRequest</span><span class="o">(</span><span class="s2">&quot;javascript:*your function*();&quot;</span><span class="o">);</span> </span><span id="L-2"><a name="L-2"></a><span class="n">navigateToURL</span><span class="o">(</span> <span class="n">urlReq</span> <span class="o">,</span> <span class="s2">&quot;_self&quot;</span> <span class="o">);</span> </span></pre></div> </td></tr></table>
"firefox 3", ff3, flash, javascript, osx

JavaScript

Detección de objetos

1
2
3
4
5
6
7
function getClassName(klass){
	if (document.getElementsByClassName) {
		return document.getElementsByClassName(klass);
	} else {
		// código alternativo.
	}
}
https://snipt.net/embed/f420ded865596639632bbb14bdb0bdd3/
/raw/f420ded865596639632bbb14bdb0bdd3/
f420ded865596639632bbb14bdb0bdd3
js
JavaScript
7
2019-08-21T17:30:34
True
False
False
/api/public/snipt/2567/
deteccion-de-objetos
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">function</span> <span class="nx">getClassName</span><span class="p">(</span><span class="nx">klass</span><span class="p">){</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">if</span> <span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByClassName</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByClassName</span><span class="p">(</span><span class="nx">klass</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span> </span><span id="L-5"><a name="L-5"></a> <span class="c1">// código alternativo.</span> </span><span id="L-6"><a name="L-6"></a> <span class="p">}</span> </span><span id="L-7"><a name="L-7"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
dom, javascript, web

JavaScript

Detectar Navegador

1
2
3
4
5
6
var isIE = '\v' == 'v';
if (isIE){
	// Código IE
} else {
	// Código alternativo
}
https://snipt.net/embed/82bbeeab1d87f26727408d5874465e84/
/raw/82bbeeab1d87f26727408d5874465e84/
82bbeeab1d87f26727408d5874465e84
js
JavaScript
6
2019-08-22T11:05:38
True
False
False
/api/public/snipt/2561/
detectar-navegador
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">var</span> <span class="nx">isIE</span> <span class="o">=</span> <span class="s1">&#39;\v&#39;</span> <span class="o">==</span> <span class="s1">&#39;v&#39;</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="k">if</span> <span class="p">(</span><span class="nx">isIE</span><span class="p">){</span> </span><span id="L-3"><a name="L-3"></a> <span class="c1">// Código IE</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> <span class="k">else</span> <span class="p">{</span> </span><span id="L-5"><a name="L-5"></a> <span class="c1">// Código alternativo</span> </span><span id="L-6"><a name="L-6"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
browser, javascript, navegador

JavaScript

Test Object

1
2
3
4
var firstOb = {
   objName: "First Object",
   objAction: "Testing snipt.net"
}
https://snipt.net/embed/bac19d24607029c004b0236de60c5851/
/raw/bac19d24607029c004b0236de60c5851/
bac19d24607029c004b0236de60c5851
js
JavaScript
4
2019-08-22T11:06:28
True
False
False
/api/public/snipt/2469/
test-object
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">var</span> <span class="nx">firstOb</span> <span class="o">=</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">objName</span><span class="o">:</span> <span class="s2">&quot;First Object&quot;</span><span class="p">,</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">objAction</span><span class="o">:</span> <span class="s2">&quot;Testing snipt.net&quot;</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
javascript

JavaScript

generate random number between two specific numbers in javascript

Math.floor(Math.random() * (7000 - 3000)) + 3000);
https://snipt.net/embed/38bb738bd5cfe4c981ea6164d49f6a39/
/raw/38bb738bd5cfe4c981ea6164d49f6a39/
38bb738bd5cfe4c981ea6164d49f6a39
js
JavaScript
1
2019-08-22T11:07:35
True
False
False
/api/public/snipt/2057/
generate-random-number-between-two-specific-numbers-in-javascript
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span> <span class="o">*</span> <span class="p">(</span><span class="mi">7000</span> <span class="o">-</span> <span class="mi">3000</span><span class="p">))</span> <span class="o">+</span> <span class="mi">3000</span><span class="p">);</span> </span></pre></div> </td></tr></table>
javascript

JavaScript

js hello world

window.alert("hello snipt");
https://snipt.net/embed/c8040a51950f7c975ecceabc7a5e9938/
/raw/c8040a51950f7c975ecceabc7a5e9938/
c8040a51950f7c975ecceabc7a5e9938
js
JavaScript
1
2019-08-22T11:07:55
True
False
False
Jul 19, 2012 at 11:58 AM
/api/public/snipt/2027/
js-hello-world
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">window</span><span class="p">.</span><span class="nx">alert</span><span class="p">(</span><span class="s2">&quot;hello snipt&quot;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
"hello world", alert, javascript