Friday 5 September 2014

How to change font size in HTML page dynamically using Java Script.

 How to change font size in HTML page dynamically using Java Script.

<!DOCTYPE html>
<html>
<head>
</head>
<body onload="populatecombo()">
<p>Click "Try it" to display the value.</p>
<div id="combodiv"></div>
<br><br>
<div id="demo">Font width changed</div>

<script>

function populatecombo()
{
var s="Select width : <select id='combo' onchange='myFunction()'>";
for(var i=1;i<=100;i++)
s+="<option id=" + i + " value=" + i + ">" + i + "</option>";
s+="</select>";
document.getElementById("combodiv").innerHTML=s;
document.getElementById("combo").value=10;
document.getElementById("demo").style.font = "italic small-caps bold " + document.getElementById("combo").value + "px  arial, sans-serif";
}

function myFunction()
    {
        document.getElementById("demo").style.font = "italic small-caps bold " + document.getElementById("combo").value + "px  arial, sans-serif";
    }

</script>

</body>
</html>

Thursday 4 September 2014

How to create a trance fm gadget using VB6

This is a simple VB6 program that embed one html file in resource in the application that contains
code that retrieves the online gadget of trance.fm.

Here is the HTML code

<html>
<body background="E:\earth-from-space-high-resolution-8909-hd-wallpapers.jpg">
<div>
<table border="0" cellpadding="0" cellspacing="0" align="center" width=100%>
<tbody>
<tr>
<td align="center" valign="middle">
<iframe id="view_frame" name="view_frame" style="border: 3px double rgb(201, 201, 201)" allowtransparency="true" scrolling="no" src="http://desktopify.com/view.php?widget=Trance Fm widget" frameborder="0" height="68" width="256">
Browser don't support frames
</iframe></td>
</tr>
</tbody></table>
</div>
</body>
</html>

Now you need to save this into one HTML file and add it into application through VB resource
editor.

And here is the form source code. I have given the source code link also below the form source code.

Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2

Private Sub Form_Load()
    'WB1.Navigate2 "file:///C:/Documents%20and%20Settings/User/Desktop/trancfm.html"
    WB1.Navigate "res://" & App.EXEName & ".exe/HTML/101"
End Sub

Private Sub Image1_Click()
    End
End Sub

Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    End
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture
    SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 And Shift = 1 Then
    End If
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture
    SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End Sub

Source code link :

Source Code