Skip to main content

Posts

Showing posts from June, 2009

Send HTML Form Elements Value Without Using Form Tag

How to send form components value without using Form Tag in HTML, ? This example will help your to send HTML elements value from one page to another page without using HTML Form Tag. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT=""> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <BODY> <script language="javascript"> function goFor(){ var ele = document.getElementById("URL"); if(ele.value==""){ alert("Please Enter URL."); }else{ location.href="http://www.google.com?q="+ele.value; } } </script&g

How to Replace All in Javascript

How to replace all string using javascript replace function... Here is simple example replace all in javascript in replace string method. CODE: <Script Language="javascript"> var str = "This is the test string."; var rs = str.replace(/is/g,""); document.write(st); // result "Th the test string." </Script>

How to send variables from on SWF flex file to another SWF file Using Flex.

How to Communicate From one SWF Flex file to another SWF Flex File ? See the below example, This is loading external swf flex file into parent SWF File and sharing the data or variable from parent to child and child to parent. Parent.mxml CODE: 1: <?xml version="1.0" encoding="utf-8"?> 2: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%"> 3: <mx:Script> 4: <![CDATA[ 5: import mx.events.CloseEvent; 6: import mx.controls.SWFLoader; 7: import mx.managers.PopUpManager; 8: import mx.containers.TitleWindow; 9: import mx.controls.Alert; 10: 11: public var tw:SWFPlaceHolder; 12: 13: public function launchExternalSWF(title:String,swfFilePath:String):void{ 14: 15: /

How To Read RSS Using PHP

Here is the simple code to read RSS Feeds using php with simpladxml_load_string function. CODE: 1 :   <?php 2 :        $displayItems = 5; 3 :        $itemCounter = 0; 4 :        $rss = simplexml_load_file("http://put here url of RSS Feed"); 5 :        foreach($rss->channel->item as $feeds){ 6 :             $itemCounter++; 7 :             echo '<li><a href="'.$feeds->link.'">'.$feeds->title.'</a><br /><br />'; 8 :             if($itemCounter==$displayItems)break; 9 :        } 10 :   ?>

How to Check Local Machine Name and IP Address Using C#

How to check client Machine or local Machine Name and IP address using C-sharp, See the below simple example code. CODE: 1 : using System.Net; 2 : 3 : string hostName = Dns.GetHostName(); 4 : IPHostEntry ie = Dns.GetHostByName(hostName); 5 : IPAddress[] ia= ie.AddressList; 6 : 7 : MessageBox.Show("Local Machine Name : "+hostName.ToString()); 8 : MessageBox.Show("IP address Of Local Machine "+ipAddress[0].ToString());

How to Check Internet Connection Using C-Sharp

How to check internet connection using c#? Here is a simple example to find out internet connection or page response using c -Sharp CODE: 1 : Using System.Net ; 2 : try{ 3 : HttpWebRequest request= (HttpWebRequest) HttpWebRequest.Create("google.com"); 4 : HttpWebResponse response= (HttpWebResponse) request.GetResponse(); 5 : if (HttpStatusCode.OK == response.StatusCode) 6 : { 7 : //Write here your code... 8 : response.Close(); 9 : } 10 : }catch (Exception ex){ 11 : MessageBox.Show("Unable to connect"); 12 : }

How to Format My Source Code For Blogger ?

How to format my source code for blogger, blog, Blogging, weblog & website ? Now you can format you source code for blogger, blog, Blogging, weblog & website using online source code formatter. This application build in javascript. This source code beautifier or formatter provide for your blogger, Blog and websites a good code indentation. You can can format your source code with alternative background using <pre> tag. It does not add unnecessary tags in formatted source code excpet <pre> and <code> so just try onto your source code for blog or blogging & website posts . This is absolutly free online line source code formatter tool for your blogger & website. http://codeformatter.blogspot.com/ See example.. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT=""> <META NAME="A

Search Records into XML Using PHP

There is an example for search items or block into xml using php with simplexml_load_string method or function, this will return you record block for particular query. query = us CODE: 1 :   <?php 2 :        # parm query=delhi , us 3 :        $xmlStr = '<?xml version="1.0" encoding="utf-8"?> 4 :                            <temprature> 5 :                            <item> 6 :                                 <city>Bareilly</city> 7 :                                 <state>Uttar Pradesh</state> 8 :                                 <country>India</country> 9 :                                 <lat>32.4567</lat> 10 :                                 <lon>34.4567</lon> 11 :                                 <temp>43.0</temp> 12 :                            </item> 13 :                            <item> 14 :                                 <city>Haldwani</city&

Center Alignment of popup window Javascript

How to centralized popup window using Javascript. see the below code. CODE: 1 :   var OpenWindows = new Object(); 2 :   function OpenWin(sPath, w, h) 3 :   { 4 :        l = (screen.width - w)/2-5; 5 :        t = (screen.height - h)/2-20; 6 :        if (l<1) l=0; 7 :        if (t<1) t=0; 8 :        sWindowName = "mainwin_" + w + "_" + h; 9 :        if(OpenWindows[sWindowName]) { 10 :             if(!OpenWindows[sWindowName].closed) OpenWindows[sWindowName].close(); 11 :        } 12 :        OpenWindows[sWindowName] = window.open(sPath, sWindowName, "left=" + l + ",top=" + t + ",width=" + w + ",height=" + h + ",scrollbars=no,menubar=no,toolbars=no,status=no"); 13 :        return OpenWindows[sWindowName]; 14 :   }

How To Change Form Action at Runtime

How to change Form action at runtime using javascript. This the example which will change html form action at runtime. CODE: 1 :   <html> 2 :   <head> 3 :   <Script Language="javascript"> 4 :   function change_action(){ 5 :   var frm_obj=document.getElementById("frm"); 6 :   frm_obj.action="http://www.google.com"; 7 :   } 8 :   </Script> 9 :   </head> 10 :   <body> 11 :   <form id="frm" action="abc.php" method="post" onsubmit="return change_action()"> 12 :   UID &nbsp;&nbsp;<input type="text"><br> 13 :   PWD <input type="Password"><br><br> 14 :   <input type="submit" value="submit"> 15 :   </form> 16 :   </body> 17 :   </html>

Change Div Position Randomly on Home Page

Change Div position randomly on home page.here is simple example which display a div randomly on homepage within available width and hight. CODE: 1 :   <Script Langauge="javscript"> 2 :   var load=true; 3 :   var div_width=300; 4 :   var div_height=200; 5 :   var top=Math.floor(Math.random()*screen.availHeight - div_height) 6 :   var left=Math.floor(Math.random()*screen.availWidth - div_width) 7 :   document.write("<div id='pic_div' style='border:1px solid black;position:absolute;width:"+div_width+";height:"+div_height+"; 8 :   text-align:center;left:0px;top:0px'>a</div>"); 9 :   var d_obj=document.getElementById("pic_div"); 10 :   d_obj.style.top=top; 11 :   d_obj.style.left=left; 12 :   </script>