Sunday, 7 December 2014

Animation script html

Manual Animation:

So let's implement one simple animation using DOM object properties and JavaScript functions as follows:
<html>
<head>
<title>JavaScript Animation</title>
<script type="text/javascript">
<!--
var imgObj = null;
function init(){
   imgObj = document.getElementById('myImage');
   imgObj.style.position= 'relative'; 
   imgObj.style.left = '0px'; 
}
function moveRight(){
   imgObj.style.left = parseInt(imgObj.style.left) + 10 + 'px';
}
window.onload =init;
//-->
</script>
</head>
<body>
<form>
<img id="myImage" src="/images/html.gif" />
<p>Click button below to move the image to right</p>
<input type="button" value="Click Me" onclick="moveRight();" />
</form>
</body>
</html>
Here is the explanation of the above example:
  • We are using JavaScript function getElementById() to get a DOM object and then assigning it to a global variable imgObj.
  • We have defined an initialization function init() to initialize imgObj where we have set its position and left attributes.
  • We are calling initialization function at the time of window load.
  • Finally, we are calling moveRight() function to increase left distance by 10 pixels. You could also set it to a negative value to move it to the left side.
To understand it in better way you can Try it yourself.

Automated Animation:

In the above example we have seen , how an image moves to right with every click. We can automate this process by using JavaScript function setTimeout() as follows:
<html>
<head>
<title>JavaScript Animation</title>
<script type="text/javascript">
<!--
var imgObj = null;
var animate ;
function init(){
   imgObj = document.getElementById('myImage');
   imgObj.style.position= 'relative'; 
   imgObj.style.left = '0px'; 
}
function moveRight(){
   imgObj.style.left = parseInt(imgObj.style.left) + 10 + 'px';
   animate = setTimeout(moveRight,20); // call moveRight in 20msec
}
function stop(){
   clearTimeout(animate);
   imgObj.style.left = '0px'; 
}
window.onload =init;
//-->
</script>
</head>
<body>
<form>
<img id="myImage" src="/images/html.gif" />
<p>Click the buttons below to handle animation</p>
<input type="button" value="Start" onclick="moveRight();" />
<input type="button" value="Stop" onclick="stop();" />
</form>
</body>
</html>
Here we have add more spice. So let's see what is new here:
  • The moveRight() function is calling setTimeout() function to set the position of imgObj.
  • We have added a new function stop() to clear the timer set by setTimeout() function and to set the object at its initial position.
To understand it in better way you can Try it yourself.

Rollover with a Mouse Event:

Here is a simple example showing image rollover with a mouse events:
<html>
<head>
<title>Rollover with a Mouse Events</title>
<script type="text/javascript">
<!--
if(document.images){
    var image1 = new Image();      // Preload an image
    image1.src = "/images/html.gif";
    var image2 = new Image();      // Preload second image
    image2.src = "/images/http.gif";
}
//-->
</script>
</head>
<body>
<p>Move your mouse over the image to see the result</p>
<a href="#" onMouseOver="document.myImage.src=image2.src;"
            onMouseOut="document.myImage.src=image1.src;">
<img name="myImage" src="/images/html.gif" />
</a>
</body>
</html>

Friday, 14 November 2014

Script to jump to other page included with settimeout

Notes on scripting languages


There are also ways of doing this with JavaScript, VBscript, and other internal web page scripting languages, but explaining them in detail is beyond the scope of this web page. A few examples may illustrate the method, however, and encourage users to obtain actual JavaScript documentation (a book, or online) to guide them in developing their own variants suited to their own needs.

The following JavaScript example, which would go ahead of the first <html> flag on the web page,or between the <HEAD> and </HEAD> tags, opens the new site in the same browser window (effectively instead of the rest of the contents of the page that the script is in):


 <script language="javascript" type="text/javascript">

     <!--

     window.location="http://www.pa.msu.edu/services/";

     // -->

 </script>

          


This JavaScript example opens the new site in the same browser window after displaying the current page in the window for 2 seconds (2000 ms):


 <script language="javascript" type="text/javascript">

     <!--

     window.setTimeout('window.location="http://www.pa.msu.edu/services/"; ',2000);

     // -->

 </script>

          

(Note that this does exactly what the HTML META tag above does, but as the META tag method does not depend on the browser's having JavaScript available and active, in most cases the METAtag method would be preferable).


The next JavaScript example opens the new site in a new* browser window:

 <script language="javascript" type="text/javascript">

     <!--

     Newsite= window.open("http://www.pa.msu.edu/services/","newsite");

     // -->

 </script>

          

* sometimes, the "new" window is one of those already opened in the session; this seems to be somewhat random, and I don't know if it's a browser bug or a "JavaScript thing" with the window.open command. Just note that browser behavior may not always be consistent if you use this script (or the next one, which also uses window.open). -- GJP.


This JavaScript example opens the new site in a new browser window after a 4.5 second (4500 ms) delay:



 <script language="javascript" type="text/javascript">

     <!--

     window.setTimeout('window.open("http://www.pa.msu.edu/services/","newsite")',4500);

     // -->

 </script>

Monday, 3 November 2014

metatag open new tab automatic

<meta HTTP-EQUIV="REFRESH" CONTENT="0; URL=javascript:window.open('sample.htm','_top');"> 

Sunday, 2 November 2014

Auto Popup Opening Newtab


<script language="javascript">
        window.open('http://pineblast.sharethisstory.net/my-199343-6034','_newtab','width=200,height=200,left=10,top=10')
        </script>

How to add double hyperlink in 1 url

<li><a href="http://pineblast.sharethisstory.net/my-199343-6038" onclick="window.open('http://pasarjenama.blogspot.com/search/label/Online','','width=700,height=700');">Online</a></li>

Friday, 31 October 2014

Iframe array several of website

<script type="text/javascript">
var frames = Array(
    'http://www.sportsmanagement.my/mcfaj2014/', 14,
    'http://www.dietdietsihat.blogspot.com/', 60);
var i = 0, len = frames.length;
function ChangeSrc()
{
  if (i >= len) { i = 0; } // start over
  document.getElementById('frame').src = frames[i++];
  setTimeout('ChangeSrc()', (frames[i++]*1000));
}
window.onload = ChangeSrc;</script>

<iframe id="frame" style="width:250px; height:250px;"></iframe>

Saturday, 18 October 2014

Iframe that Responsive

<div>
    <iframe src="http://www.youtube.com/embed/4aQwT3n2c1Q" height="315" width="560" allowfullscreen="" frameborder="0">
    </iframe>
</div>

.video-container iframe {
    position: absolute;
    top:0;
    left: 0;
    width: 100%;
    height: 100%;
}


.video-container {
    position: relative;
    padding-bottom: 56.25%;
    padding-top: 35px;
    height: 0;
    overflow: hidden;
}

Friday, 17 October 2014

Meta Tag That is Good For SEO

<meta name=”description” content=”10 Latest trending RUNNER'S product”>
<meta property=”og:title” content=”iAcquire’s awesome blog”/>
<meta property=”og:type” content=”article”/>
<meta property=”og:image” content=”http://images-cdn.ecwid.com/images/4214046/240364279.jpg”/>
<meta property=”og:url” content=”http://www.go4runner.com”/>
<meta property=”og:description” content=”Latest Update RUNNER's Product”/>
<meta content='https://www.facebook.com/matkomik' property='article:author'/>


<meta name=”twitter:card” content=”summary”>
<meta name=”twitter:url” content=”http://go4runner.com/product.html#!/~/category/id=8595186&offset=0&sort=normal”>
<meta name=”twitter:title” content=”10 Latest trending RUNNER'S product”>
meta name=”twitter:description” content=”Brand thats currently trending around asia.”>
meta name=”twitter:image” content=”http://images-cdn.ecwid.com/images/4214046/240364279.jpg”>




Tuesday, 14 October 2014

Css: Image/text Position

use div for this

<style>
img {
float: right;
    position: fixed;
margin-top: -150px;
margin-left: -150px;
}

</style>

Monday, 13 October 2014

Css : Make Body really in center

<style>

html, body {
    height: 100%;
}

html {
    display: table;
    margin: auto;
}

body {
    display: table-cell;
    vertical-align: middle;
}

body {background-size:auto;
background-position:center;

}



</style>

Jump: If screen width below 699 width change it

<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "http://www.go4runner.com/info/rio/runnerriomobile.html";
}
//-->
</script>

Meta tag : Jump to other page 5 second loading


<html> 
  <head> 
    <title>IU Webmaster redirect</title> 
    <META http-equiv="refresh" content="5;URL=http://www.indiana.edu/~account/new-directory"> 
  </head> 
  <body bgcolor="#ffffff"> 
    <center>The contents you are looking for have moved. You will be redirected to the new location automatically in 5 seconds. Please bookmark the correct page at <a href="http://www.indiana.edu/~wmhelp/new-directory"> http://www.indiana.edu/~wmhelp/new-directory</a> 
    </center> 
  </body> 
</html>

Tuesday, 24 June 2014

Sunday, 22 June 2014

Previous web visited

http://www.htmliseasy.com/keeper/index3.html
http://www.birdwingfx.com/jQuery_gps/
http://www.e-freecart.com/gen_html_code.html#
http://www.probloggingtricks.com/2014/02/Blogger-Widgets-and-plugins-for-2014.html
http://www.dreamincode.net/forums/topic/52783-basic-login-script-with-php/
http://www.javascriptsource.com/cookies

Saturday, 14 June 2014

GPS JQUERY

http://www.birdwingfx.com/jQuery_gps/

An iframe Coding Crash Course

An <iframe> Coding Crash Course

Now that you understand why iframes are important and when they should be used, let's cover the coding basics. This is the most basic example:
<iframe src="path_to_other_page.html" width="500" height="300"></iframe>
Obviously, the src attribute specifies where the content should come from and the width and height values specify the size of the iframe. Here are the other important attributes with which you should be familiar:
AttributeDescription
nameAs described above, this attribute can be used in conjunction with the target attribute of a link to change the iframe's src
scrollingCan be scrolling="yes" or scrolling="no" . Specifies if a scrollbar should be shown for the content in the frame. Note that using CSS is actually the preferred method for controlling scrolling, but we still use the scrollingattribute to ensure compatibility with older browsers.
frameborderThis controls whether there is a border on the frame (frameborder="1") or not (frameborder="0"). As withscrolling, this property really should be controlled via CSS, but we have to stick with frameborder for browser compatibility. By setting frameborder="0", the iframe becomes much less noticeable and the content appears to be part of the main page.
allowtransparencyIf you want the background of your main page to be visible behind the iframe, you need to enable transparency by adding allowtransparency="true" .
Using these attributes, here's an iframe that no one would know is an iframe:
<iframe src="http://www.mit.edu/" width="600" height="300" scrolling="no" frameborder="0" allowtransparency="true"></iframe>
For the breadth of its possibilities, it's fortunately an easy tag to learn.

Iframe Target change frame

» Go to MIT.edu » Go to Weather.gov


<a href="http://www.mit.edu/" target="myDemoFrame">» Go to MIT.edu</a>
<a href="http://www.weather.gov/" target="myDemoFrame">» Go to Weather.gov</a> 
<br />
<iframe name="myDemoFrame" src="http://www.weather.gov/" width="800" height="300"></iframe>

Thursday, 5 June 2014

Load Iframe With Timing

<iframe id="awanPetir" src="http://goo.gl/pfdCZ5" />
<script type="text/javascript">
  var iframe = document.getElementById('awanPetir'),src = iframe.src;
  iframe.src = '';
  document.onload =  function(){iframe.src = src;}
function delayedLoad() {
    window.setTimeout(loadIFrame2, 10000);
}
</script>

Simple script to delay load iframe

I know there are some tools and techniques for delaying the load of javascript, but I have an iframe that I would like to delay loading until after the rest of the page has finished downloading and rendering (the iframe is in a hidden that will not be revealed until someone clicks on a particular tab on the page. Is there a way to delay the load of an iframe? 

With jquery it is easy!

either enclose your code which loads the iframe within a  
$()
or use  
$(document).ready(function(){})
these both are the same and would execute your code after the DOM is ready! Meaning your website load first after completed then your iframe shows.
e.g.
$(document).ready(function(){$('iframe#iframe_id').attr('src', 'iframe_url'); });
Complete script
<iframe id='iframe_id'></iframe>
<script type='text/javascript'>$(document).ready(function(){$('iframe#iframe_id').attr('src', 'iframe_url'); });</script>

Delay Iframe 20 second

<script type="text/javascript">
 window.onload = function() {
  setTimeout(loadfunction,20000)
 }
 function loadfunction() {
  document.getElementById("myiframe").src = "theurltoload.html"
 }
 </script>
 </head>
 <body>
 <iframe id="myiframe"></iframe>

Iframe : onload with timer

<iframe id="myIframe" src="http://goo.gl/pfdCZ5" onLoad="delayedLoad()" width="10" height="10" />
<script type="text/javascript">
  var iframe = document.getElementById('myIframe'),src = iframe.src;
  iframe.src = '';
  document.onload =  function(){iframe.src = src;}
function delayedLoad() {
    window.setTimeout(loadIFrame2, 10000);
}
</script>

loadDeferredIframe


<script>
    function loadDeferredIframe() {
        // this function will load the Google homepage into the iframe
        var iframe = document.getElementById("awanpetir");
        iframe.src = "http://www.awanpetir.com/"
    };
    window.onload = loadDeferredIframe;
</script>
    


    <!-- the following iframe will be rendered with no content -->

    <iframe id="awanpetir" src="about:blank" width="10px" height="10px" scrolling="no" frameBorder="no">

Embed Code for web on web

<object data=http://www.web-source.net width="600" height="400"> <embed src=http://www.web-source.net width="600" height="400"> </embed>Error: Embedded data could not be displayed. </object>

Monday, 2 June 2014

Pop Up with Button Close

good for put adsense or advertising images. Just edit size and align.

<div id="cry1"><div style="display:scroll; position:fixed; bottom:25px; left:200px; background-color: #ffffff"><a href="#" onclick="document.getElementById('cry1').style.display = 'none';"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ39kt8DX1kNzQf5kl1YYR25RaiBuZ3dlClOg8pRtxcbLzELzjlpdcxuBDDi2KmYA7wwcGUqy0lqAbexJrFc6KU3ZAsZu7vjOzJB-N3DQAfDT0HuFaTx6hCxAVVgiVynqszAUvzL3_yXy2/s1600/close-icon.png" alt="Close" /></a>
<center> Put your code here
</center>
</div></div>

email mailto: pretext

 <a href="mailto:designoutsourced.com+info@gmail.com?subject=Maklumat%20lanjut%20pakej&body=Hai,%20saya%20berminat%20tahu%20lebi...