Jump to content

tarun

Members
  • Posts

    321
  • Joined

  • Last visited

    Never

Posts posted by tarun

  1. Page 1

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function openChild(file,window) {
        childWindow=open(file,window,'resizable=no,width=200,height=400');
        if (childWindow.opener == null) childWindow.opener = self;
        }
    //-->
    </SCRIPT>
    <FORM NAME="parentForm">
    <INPUT TYPE="button" VALUE="Open child" onClick="openChild
    ('page2.html','win2')">
    <BR><INPUT NAME="pf1" TYPE="TEXT" VALUE="">
    <BR><INPUT NAME="pf2" TYPE="TEXT" VALUE="">
    </FORM>

     

    Page 2

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function updateParent() {
        opener.document.parentForm.pf1.value = opener.document.parentForm.pf1.value + document.childForm.cf1.value;
        opener.document.parentForm.pf2.value = opener.document.parentForm.pf2.value + document.childForm.cf2.value;
        self.close();
        return false;
    }
    //-->
    </SCRIPT>
    <FORM NAME="childForm" onSubmit="return updateParent();">
    <BR><INPUT NAME="cf1" TYPE="TEXT" VALUE="">
    <BR><INPUT NAME="cf2" TYPE="TEXT" VALUE="">
    <BR><INPUT TYPE="SUBMIT" VALUE="Update parent">
    </FORM>

     

     

    That Should Do It Just Test It And Play Around With It

    Thnx,

    Tarun

  2. Simple Rollover

     

    <img src="img.gif" onmouseover="javascript:this.src='imgover.gif';" onmousedown="javascript:this.src='imgdown.gif';" onmouseout="javascript:this.src='img.gif';">

  3. Try This:

     

    <script>
    function printpreview()
    {
    
    
    var OLECMDID = 7;
    /* OLECMDID values:
    * 6 - print
    * 7 - print preview
    * 1 - open window
    * 4 - Save As
    */
    var mydoc = document.getElementById('popup_schedule').innerHTML;
    var PROMPT = 1; // 2 DONTPROMPTUSER 
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"  ></OBJECT>';
    
    document.getElementById('schedule').style.display='none';
    document.getElementById('popup_schedule').style.display='';
    
    document.body.insertAdjacentHTML('beforeEnd',WebBrowser); 
    WebBrowser1.ExecWB(OLECMDID, PROMPT);
    WebBrowser1.outerHTML = "";
    
    document.getElementById('schedule').style.display='';
    document.getElementById('popup_schedule').style.display='none';
    }
    </script>
    
    <a href="javascript:printpreview()">Print Preview</a>
    
    <div id="schedule"></div>
    <br>
    <div id="popup_schedule"></div>
    <br>
    <div id="beforeEnd"></div>

  4. page1.html

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function openChild(file,window) {
        childWindow=open(file,window,'resizable=no,width=200,height=400');
        if (childWindow.opener == null) childWindow.opener = self;
        }
    //-->
    </SCRIPT>
    <FORM NAME="parentForm">
    <INPUT TYPE="button" VALUE="Open child" onClick="openChild
    ('page2.html','win2')">
    <BR><INPUT NAME="pf1" TYPE="TEXT" VALUE="">
    <BR><INPUT NAME="pf2" TYPE="TEXT" VALUE="">
    </FORM>

     

    page2.html

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function updateParent() {
        opener.document.parentForm.pf1.value = document.childForm.cf1.value;
        opener.document.parentForm.pf2.value = document.childForm.cf2.value;
        self.close();
        return false;
    }
    //-->
    </SCRIPT>
    <FORM NAME="childForm" onSubmit="return updateParent();">
    <BR><INPUT NAME="cf1" TYPE="TEXT" VALUE="">
    <BR><INPUT NAME="cf2" TYPE="TEXT" VALUE="">
    <BR><INPUT TYPE="SUBMIT" VALUE="Update parent">
    </FORM>

     

    Works Like A Charm Just Try It Out

    An Example Is Also Available: Here

  5. The Answer Is You Can't

     

    Theres One Method...

    <SCRIPT LANGUAGE="JavaScript">
    
    function goNewWin() {
    
    //***Get what is below onto one line***
    
    window.open("non59EC.htm",'TheNewpop','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); 
    
    //***Get what is above onto one line*** 
    
    self.close()
    
    }
    
    </SCRIPT> 
    
    <A HREF="javascript:goNewWin()">Click to go to a new page</A> 

     

     

     

    It Opens A New Window And Then Close The Old One...Simple

     

     

    There Are Plenty More Though... - Just Search Google

  6. <?php
    if (!($fp=@fopen("topics.xml", "r"))) {
    echo ("Forum Could Failed To Load");
    return;
    }
    $usercount1=0;
    $usercount2=0;
    $usercount3=0;
    $userdata=array();
    $state='';
    
    function startElementHandler ($parser,$name,$attrib){
    global $usercount;
    global $userdata;
    global $state;
    
    switch ($name) {
    case $name=="IMPORTANT" : {
    $userdata[$usercount]["type_i"] = $attrib["TYPE"];
    $userdata[$usercount]["who_i"] = $attrib["WHO"];
    $userdata[$usercount]["id_i"] = $attrib["ID"];
    $userdata[$usercount]["date_i"] = $attrib["DATE"];
    $userdata[$usercount]["time_i"] = $attrib["TIME"];
    $userdata[$usercount]["title_i"] = $attrib["TITLE"];
    $userdata[$usercount]["posts_i"] = $attrib["POSTS"];
    break;
    }
    case $name=="STICKY" : {
    $userdata[$usercount]["type_s"] = $attrib["TYPE"];
    $userdata[$usercount]["who_s"] = $attrib["WHO"];
    $userdata[$usercount]["id_s"] = $attrib["ID"];
    $userdata[$usercount]["date_s"] = $attrib["DATE"];
    $userdata[$usercount]["time_s"] = $attrib["TIME"];
    $userdata[$usercount]["title_s"] = $attrib["TITLE"];
    $userdata[$usercount]["posts_s"] = $attrib["POSTS"];
    break;
    }
    case $name=="TOPIC" : {
    $userdata[$usercount]["type_t"] = $attrib["TYPE"];
    $userdata[$usercount]["who_t"] = $attrib["WHO"];
    $userdata[$usercount]["id_t"] = $attrib["ID"];
    $userdata[$usercount]["date_t"] = $attrib["DATE"];
    $userdata[$usercount]["time_t"] = $attrib["TIME"];
    $userdata[$usercount]["title_t"] = $attrib["TITLE"];
    $userdata[$usercount]["posts_t"] = $attrib["POSTS"];
    break;
    }
    
    default : {$state=$name;break;}
    }
    }
    
    function endElementHandler ($parser,$name){
    global $usercount;
    global $userdata;
    global $state;
    $state='';
    if($name=="REPLY") {$usercount++;}
    }
    
    function characterDataHandler ($parser, $data) {
    global $usercount;
    global $userdata;
    global $state;
    if (!$state) {return;}
    }
    if (!($xml_parser = xml_parser_create())) die("Couldn't Create Parser.");
    xml_set_element_handler( $xml_parser, "startElementHandler", "endElementHandler");
    xml_set_character_data_handler( $xml_parser, "characterDataHandler");
    
    while( $data = fread($fp, 4096)){
    if(!xml_parse($xml_parser, $data, feof($fp))) {
    break;}}
    xml_parser_free($xml_parser);
    
    echo "\n<table class=\"forum\">\n";
    echo "<tr>\n";
    echo "<td>Topic Title:</td>\n";
    echo "<td>Posts</td>\n";
    echo "</tr>\n";
    
    for ($i=0;$i<$usercount1; $i++) {
    if ($userdata[$i]["title_i"]) {
    	echo "<tr>\n";
    	echo "<td>Important: ".$userdata[$i]["title_i"]."</td>\n";
    	echo "<td>".$userdata[$i]["posts_i"]."</td>\n";
    	echo "</tr>\n";
    }
    }
    
    for ($i=0;$i<$usercount2; $i++) {
    if ($userdata[$i]["title_s"]) {
    	echo "<tr>\n";
    	echo "<td>Sticky: ".$userdata[$i]["title_s"]."</td>\n";
    	echo "<td>".$userdata[$i]["posts_s"]."</td>\n";
    	echo "</tr>\n";
    }
    }
    
    for ($i=0;$i<$usercount3; $i++) {
    if ($userdata[$i]["title_t"]) {
    	echo "<tr>\n";
    	echo "<td>".$userdata[$i]["title_t"]."</td>\n";
    	echo "<td>".$userdata[$i]["posts_t"]."</td>\n";
    	echo "</tr>\n";
    }
    }
    echo "</table>\n";
    ?>

     

     

    Well This Is The Code For A Forum.

    Ive Used Virtually The Exact Same Code For Another Script

    But Why Doesn't It Work...?

     

    Thnx,

    Tarun

  7. I Have A PHP Upload Script

     

     

    It Works Fine When Uploading Using A Form

    But I Doesn't Work When Creating An AJAX Post

     

     

    Why...?

    Is What I Would Like To Know

    And If Possible How Can I Correct It

     

     

     

    I Do Not Which To Display The Contents Of The PHP Script But The AJAX/HTML Is Fine

     

     

    <script>
    var page = "upload.php";
    function postAJAX(url, query, target)
    {
        var status = false;
        var contentType = "application/x-www-form-urlencoded; charset=UTF-8";
    
        // Native XMLHttpRequest object
        if (window.XMLHttpRequest) {
            request = new XMLHttpRequest();
            request.onreadystatechange = function() {ajaxDone(target);};
            request.open("post", url, true);
            request.setRequestHeader("Content-Type", contentType);
            request.send(query);
            status = true;
    
        // ActiveX XMLHttpRequest object
        } else if (window.ActiveXObject) {
            request = new ActiveXObject("Microsoft.XMLHTTP");
            if (request) {
                request.onreadystatechange = function() {ajaxDone(target);};
                request.open("post", url, true);
                request.setRequestHeader("Content-Type", contentType);
                request.send(query);
                status = true;
            }
        }
    
        return status;
    }
    
    
    
    function ajaxDone(target) {
    if (request.readyState == 4) {
    	if (request.status == 200 || req.status == 304) {
    		results = request.responseText;
    		document.getElementById(target).innerHTML = results;
    		}
    		else {           document.getElementById(target).innerHTML="Ajax Error:\n" + req.statusText;
    		}
    	}
    }
    </script>

  8. Well I Used A Different Method It Was Due To Windows Vista UAC (User Account Control)

     

    Then I Did As Told And Then Restarted My Computer

    But I Got "Internet Explorer cannot display the webpage" When Viewing An http://localhost Page

     

    So I Reverted Back To The Old Files

     

    Now I Shall Wait A While And Read Up On What I Did Wrong And Learn A Bit More

    Then I May Try Again...

     

    Anyway

    Thnx For Your Help... :)

  9. I Can't Save The hosts file once ive edited it

     

    In Notepad It Says

    Cannot create the C:\Windows\System32\drivera\etc\hosts file.
    
    Make sure the path and file name are correct.

     

    And In EditPlus I Get

    This is a read-only document.

     

     

     

    I Think It's Because There Is No File Extension In The "hosts" File What Should I Do Now...?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.