顯示文章

這裡允許您檢視這個會員的所有文章。請注意, 您只能看見您有權限閱讀的文章。


文章 - NARs

頁: 1 [2] 3 4 ... 8
31
網頁技術 / Re: google map function ?
« 於: 2011-10-07 12:56 »
抱歉~忘記PO moveMarker function


代碼: [選擇]

function moveMarker(lat,lont)
{
map.setCenter(new GLatLng(lat,lont), 16);

}

32
網頁技術 / google map function ?
« 於: 2011-10-07 11:39 »
各位大大,
我用下拉式選單新增了幾個點,我想要當選了其中一點,按下button 之後,map會自動移到所選的那個位置,
但是這樣寫法好像有錯,大大可以指導一下嗎?

代碼: [選擇]
<form name="jump">
<p align="center">
<select name="menu">
<option selected>Choose One</option>
<option value="42.2734","-83.7133">p1</option>
<option value="42.2734","-83.7133">p1</option>
<option value="46.2734","-83.7133">p2</option>
<option value="21.2734","-83.7133">p3</option>
<option value="45.2734","-83.7133">p4</option>
<option value="34.2734","-83.7133">p5</option>
<option value="342734","-83.7133">p6</option>
<option value="32.2734","-83.7133">p7</option>
</select>
<input type="button" onClick="javascript:moveMarker[document.jump.menu.selectedIndex].value;" value="GO">
</p>
</form>


33
PHP程式設計討論區 / Re: 如何取得IP ?
« 於: 2011-09-27 15:25 »
大大可以說清楚點嗎 ??? ???

34
PHP程式設計討論區 / 如何取得IP ?
« 於: 2011-09-27 15:11 »
各位大大,
這是我的code,可是如果使用者有v6,會只有取得v6,如果使用者沒有v6,就會取得v4
代碼: [選擇]
if (!empty($_SERVER['HTTP_CLIENT_IP']))
      $ip=$_SERVER['HTTP_CLIENT_IP'];
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
else
      $ip=$_SERVER['REMOTE_ADDR'];

        echo $ip;
可是如果使用者有v6時,要如何同時顯示使用者ipv4 和ipv6 ?

35

請問各位大大,
要如何在按鈕按下後就會出現兩個loading等待執行的圖案




代碼: [選擇]
<html>
   <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>Testing</title>
     <script type="text/javascript" >
    function loadAjax(aaa,bbb,ccc){
         if(window.XMLHttpRequest){
         xmlhttp=new XMLHttpRequest();
      }else{
         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }

      xmlhttp.onreadystatechange=function(){
         if (xmlhttp.readyState==4 && xmlhttp.status==200){
            document.getElementById(ccc).innerHTML=xmlhttp.responseText;
         }
      }

      xmlhttp.open(aaa,bbb,true);
      xmlhttp.send();

   }
   
   
   function showString(str) {document.getElementById('StringLoading').innerHTML = str;} //回傳值會將等待圖案取代
function showValue(str) {
document.getElementById('ValueLoading').innerHTML = str;
document.getElementById("Test").disabled=false;
}
//回傳值會將等待圖案取代
</script>
   </head>
   
   <body>
   
  <table width="500" border="1">
   <applet id="myapplet" code="myapplet.class" name="myapplet" width="0" height="0" >
      <PARAM NAME=value VALUE="<?php echo $_SESSION[&#39;value&#39;] ;?>">
  </applet>
  <tr>
    <td>Show String :</td>
    <td><div id="StringLoading" style="float:left;">
<img src="images/Loading.jpg" style="vertical-align:middle;padding:6px"/>  //執行等待圖案...
 </div></td>
  </tr>
  <tr>
    <td>Show Value :</td>
    <td><div id="ValueLoading" style="float:left;">
     <img src="images/Loading.jpg" style="vertical-align:middle;padding:6px"/></div></td>  //執行等待圖案..
  </tr>
  <tr>
    <td> <input type="button" value="Test"  name="submit" onclick=javascript:loadAjax("GET","updateDB.php","Server");loadAjax("GET","re-updateDB.php","complete")></td>
    <td>&nbsp;</td>
  </tr>
</table>

   </body>
   </html>


36


各位大大,
alert 出來的divvalue是undifined,請問要怎麼取得text 值???

代碼: [選擇]
<script>
     var divvalue = document.getElementById("first").value ;  //
     alert(divvalue);
</script>


<div id="first">
<input type="hidden" value="" />
 </div>


37
Yamaka大大,
Debug後發現,是在form的部份,onsubmit和POST不能同時使用,但是使用onsubmit方式,會變成先執行javascript function ,再去提交表單,但是因為我的做法必須先提交表單,取得DB的值後,再把值丟給applet當參數,
所以請問大大,有其它的方式可以先提交表單再去執javascript function嗎?



代碼: [選擇]
<script>
function excuteApplet()
{
    document.getElementById('myapplet').go();
             return true;
}
</script>

<form action=""  name="form1" onsubmit="return excuteApplet()" method="post">
            <input  name="btn" type="submit" value="Test" id="Test"   >
            </form>





38
在applet接不到PHP 的變數,大大可以指導一下嗎?

代碼: [選擇]
if($_POST["submit"]=="Test")
{
require_once("DB_config.php");
      require_once("DB_class.php");
    $db = new DB;
        $db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
$db->query("select ID,valueA, valueB from customer ;");
      $result_num = $db->get_num_rows();
         
     
          echo "<br />";*/
   
      while($row = $db->fetch_array())
      {

       
$valueA= $row['valueA'];
$valueB= $row['valueB'];
        $ID= $row['ID'];

                                 
                                 $sql = "update customer set paid=1 where ID = '".$ID."'";
$result = $db->update($sql);
                               

  $value= $valueA;
if($total>30)
{
$value= trim($valueA);
    }
             else
   {
   $value= trim($valueB);
   }
              }
                         }
  ?>
            <applet id="myapplet" code="myapplet.class" name="myapplet" width="0" height="0" >
      <PARAM NAME=customer VALUE=<? echo $value?>>   //......接不到值??????
        </applet>


39


如果是用POST的方式,傳給同一頁的PHP接下的話,可以嗎?

代碼: [選擇]
if($_POST["submit"]=="Test")
{
........
}

代碼: [選擇]
<form name="groovyform" action=""  method="post">>
         <input name="submit" type="submit"  class="groovybutton"
   value="Test" onMouseOver="goLite(this.form.name,this.name)" onMouseOut="goDim(this.form.name,this.name)"
       onclick="this.disabled=1; document.getElementById('myapplet').go();"   >
</form>

40
是的, 大大我知道了,那請問如果是要button click時再執行的話, 大大可以指導一下要怎麼修正嗎??

41
Yamaka大大,
 只要一重整頁面或是開啟時,這段update sql就會執行更新到資料庫??????
                                 $sql = "update customer set paid=1 where ID = '".$ID."'";
            $result = $db->update($sql);
                                //----------------------------------



代碼: [選擇]
<html>
<body>
<script>
               function showMsg(str) {document.getElementById('recvApplet').innerHTML = str;}
function showMsg2(str) {
document.getElementById('recvApplet2').innerHTML = str;
document.getElementById("btn").disabled=false;
}

</script>
<?php

 require_once("DB_config.php");
    
  require_once("DB_class.php");
    
 $db = new DB;
       
$db->connect_db($_DB[&#39;host&#39;], $_DB[&#39;username&#39;], $_DB[&#39;password&#39;], $_DB[&#39;dbname&#39;]);
$db->query("select ID,valueA, valueB from customer ;");
     
 $result_num $db->get_num_rows();
          
      

          echo 
"<br />";*/
   
     
 while($row $db->fetch_array())
     
 {

        
  $valueA$row[&#39;valueA&#39;];
  $valueB$row[&#39;valueB&#39;];
        $ID$row[&#39;ID&#39;];

                                 // 只要一重整頁面或是開啟時,這段update sql就會執行更新到資料庫??????
                                 
$sql "update customer set paid=1 where ID = &#39;".$ID."&#39;";
$result $db->update($sql);
                                
//----------------------------------

  $value$valueA;
if($total>30)
{
$valuetrim($valueA);
     }
         
   else 
   {
   $valuetrim($valueB);
   }
   }
 
?>

            <applet id="myapplet" code="myapplet.class" name="myapplet" width="0" height="0" >
      <PARAM NAME=testingServer VALUE=<? echo $value?>>
        </applet>
         <br />
         <br />
          <br />
          <table width="723" border="0" align="center">
          <tr>
          <td width="406" align="center">
         
          </td>
          <td align="center"><form name="groovyform" >
          <input type="button"  name="groovybtn1"  id="btn" class="groovybutton"
   value="Begin Test" onMouseOver="goLite(this.form.name,this.name)" onMouseOut="goDim(this.form.name,this.name)"
       onclick="this.disabled=1; document.getElementById('myapplet').go();"   >
</form>

</td>
.........
......

</body>
</html>

42
大大,
是的,空白的問題我已經改掉了,可是還是一樣的問題,在開啟網頁或是更新頁面時,就會自動執行go function ,而不是等到按鈕click才執行?

43
大大,
applet code改了沒是一樣的問題,大大可以指導一下嗎?

代碼: [選擇]
<applet id="myapplet" code="myapplet.class" name="myapplet" width="0" height="0" >
   <PARAM NAME=name VALUE=<? echo $name ?>>
        </applet>

44

大大,
我是用eclipse加dreamwaver
這是我的applet簡單的code,可是在開啟網頁是,就會自動執行go function ,而不是等到按鈕click才執行????

代碼: [選擇]
mport java.applet.*;
import java.net.*;

import javax.swing.JApplet;

public class Applet_php extends Applet {
public void init(){


} public void go2(){
int sum=0;
for(int i =1;i<=5;i++)
sum =sum +i;
try {
getAppletContext().showDocument(
new URL("javascript:showString2('" + sum +"')")
);
} catch (MalformedURLException me) { }

}
public void go(){
int sum=0;
for(int i =1;i<=10;i++)
sum =sum +i;
try {
getAppletContext().showDocument(
new URL("javascript:showString('" + sum +"')")
);
} catch (MalformedURLException me) { }

}


public static void main(String[] args) {
}

}




45
Yamaka大大,
依照你的範例,加了一個按鈕,我想要在按鈕click時,再去執行applet的function , 但是在refresh時,就會自動執行,請問大大是那錯了嗎?大大可以指導一下嗎??

代碼: [選擇]
import java.applet.*;
import java.net.*;

public class CallJS extends Applet {
  public void init()
{}
  public void go(){
    String msg = "嗨~嗨~~ 我是 Java Applet 的字串!";
    try {
      getAppletContext().showDocument(
        new URL("javascript:showString('" + msg +"')")
      );
    } catch (MalformedURLException me) { }
  }
}


代碼: [選擇]
<html>
<head></head>
<body>
<script>
function showString(str) {
  document.getElementById('strDemo').innerHTML = str;
}
</script>
<div id="strDemo"></div>
<applet  id="myapplet" code="CallJS .class" name="myapplet" width="30" height="20"></applet>
 <input type="button"  name="groovybtn1"  id="btn" class="groovybutton"
   value="Begin" onclick="this.disabled=1; document.getElementById('myapplet').go();"   >

</body>
</html>


46
網頁技術 / button事件,連接db?
« 於: 2011-08-29 18:56 »

要如何在按下時,connect mysql , 執行PHP 的mysql的update 指令???




代碼: [選擇]
import java.applet.*;
import java.net.*;

import javax.swing.JApplet;

public class Applet_php extends Applet {
public void init(){


} public void go2(){
int sum=0;
for(int i =1;i<=5;i++)
sum =sum +i;
try {
getAppletContext().showDocument(
new URL("javascript:showString('" + sum +"')")
);
} catch (MalformedURLException me) { }

}
public void go(){
int sum=0;
for(int i =1;i<=10;i++)
sum =sum +i;
try {
getAppletContext().showDocument(
new URL("javascript:showString2('" + sum +"')")
);
} catch (MalformedURLException me) { }

}


public static void main(String[] args) {
}

}



代碼: [選擇]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>

<body>
<script language="JavaScript" type="text/javascript">
function showString(str) {
  document.getElementById('strDemo').innerHTML = str;
}
<?php
  $dbhost 
= &#39;127.0.0.1&#39;;
    
$dbuser = &#39;mysql_user&#39;;
    
$dbpass = &#39;mysql_password&#39;;
    
$dbname = &#39;mysql_databaseName&#39;;
    
$conn mysql_connect($dbhost$dbuser$dbpass) or die(&#39;Error with MySQL connection&#39;);
    
mysql_query("SET NAMES &#39;utf8&#39;");
    
mysql_select_db($dbname);
    
$sql "update customer set status =1;";
    
$result mysql_query($sql) or die(&#39;MySQL query error&#39;);
   


?>


function showString2(str) {
  document.getElementById('strDemo2').innerHTML = str;
}
</script>
<div id="strDemo"></div>
<div id="strDemo2"></div>
<applet  id="myapplet" code="Applet_php.class" name="myapplet" width="30" height="20"></applet>
<input type="button"  name="groovybtn1"  id="btn" class="groovybutton"
   value="Begin " onclick="document.getElementById('myapplet').go2();"   >  //要如何在按下時,執行PHP 的mysql的update 指令???
</body>
</html>



47
page1.php就是目前執行的這頁...不行嗎?

48
用submit可以嗎?
我想要在同一個頁面 , 當頁面載入完畢時,把javascript 的值傳給PHP,透過Javascript variable to Form variable再Form variable to PHP variable
可是一直沒取到值,請問是那裡錯了嗎?


代碼: [選擇]

if (document.addEventListener) {
alert("document.addEventListener");

document.InfoPassed.submit();
  } else {
  alert("none document.attachEvent");

  }

 <form name="InfoPassed" id="InfoPassed"  action="page1.php" method="post"  >
<input type="text" name="PhpVariable"/>

</form>

<?php
if(isset($_POST["formvar"])){
 $value $_POST["formvar"];
                        echo  
$value;
}
?>


49
網頁技術 / Re: 按鈕事件 ?
« 於: 2011-08-24 15:22 »
loading 圖在按了都沒顯示,只有在一開始載入頁面時,才會顯示,請問各位大大是那錯了嗎?請大大指導一下
如何在按了Start 按鈕後,才會再出現Loading1和Loading2 的等待圖 案,直到applet傳回訊息蓋掉??



代碼: [選擇]
<script>


function showmsg1(str) {document.getElementById('Loading1').innerHTML = str;}    // 等待傳回訊息顯示,Loading1 圖案消失
function showmsg2(str) {document.getElementById('Loading2').innerHTML = str;}

 function init( ) {
_oTag = document.getElementById("Loading1");
_oTag.style.display = "";  //顯示loading img
  }

if (window.attachEvent) {
window.attachEvent('onload', init);
  } else {
window.addEventListener('load', init, false);
  }

    var btn1 = document.getElementById('btn');
                btn1.attachEvent('onclick', init);  //使用者按下按鈕後,就顯示"Loading1"

 
</script>



<div id="Loading1" style="float:left; display:none">   // 一開始並不顯示loading 圖案
 <img src="images/Loading.jpg" style="vertical-align:middle;padding:6px"/>
 </div>

50
網頁技術 / 同一個頁面javascript 傳值給PHP ?
« 於: 2011-08-24 14:44 »
想要在同一個頁面 把javascript 的值傳給PHP,透過Javascript variable 傳給 Form variable ,
再由Form variable 傳PHP variable
可是在PHP一直沒取到值,請問我在同一頁的PHP用post接可以嗎?

page1.php
代碼: [選擇]

             <script>

function showAppletMsg(str) {
document.getElementById('MSg').innerHTML = str;  //接收由applet傳回的訊息

document.InfoPassed.PhpVariable.value = str.length;//訊息長度隱藏在form裡PhpVariable
document.InfoPassed.submit();  //加了這行,頁面一直在跳動,好像一直在傳值????

}
              </script>
              <form name="groovyform" >  //按鈕執行applet
                  <input type="button"  name="groovybtn1"  id="btn" class="groovybutton"
          value="Begin" onMouseOver="goLite(this.form.name,this.name)"             
                  onMouseOut="goDim(this.form.name,this.name)"
                  onclick="this.disabled=1; document.getElementById('applet1').go();"   >
      </form>

                <applet id="applet1" code="myapplet.class" name="myapplet" width="0" height="0" >
      <PARAM NAME=parm1 VALUE='number'>
        </applet>
           
                <form name="InfoPassed" action="page1.php" method="post"  target="_self">
       <input type="hidden" name="PhpVariable" value="">
</form>
<?php

if(isset($_POST["PhpVariable"])){  //接收js傳來的訊息????
$value $_POST["PhpVariable"];
                         echo 
$value;
}
?>





51
網頁技術 / 按鈕事件 ?
« 於: 2011-08-23 17:49 »
目前按鈕按下後,會啟動applet執行,再回傳訊息回來,也就是把applet傳回結果把等待圖(Loading1和Loading2)換成傳來的訊息 ,

1.要如何在按了Start 按鈕後,按鈕就不能再按, 直到applet傳回訊息?
2.以及如何在按了Start 按鈕後,才會再出現Loading1和Loading2 的等待圖 案,直到applet傳回訊息蓋掉??


代碼: [選擇]
<script>

function showmsg1(str) {document.getElementById('Loading1').innerHTML = str;} 
function showmsg2(str) {document.getElementById('Loading2').innerHTML = str;}
</script>
<table width="723" border="0" align="center">
          <tr>
          <td width="411" align="center">
          <input type="button" name="button" id="btn" value="Start" style="background-repeat:no-repeat;border-width:0px;background-color:transparent;height:25px;width:90px;cursor:hand;font-weight:bold;font-size:16px;font-family:Arial;color:#000000;background-image:url('images/ROvlBW.gif');" onclick="document.getElementById('applet').go();" />
          </td>
          <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="center" style="font-size:20px">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
    <td width="411" align="center" style="font-size:20px">Msg_1 from Applet  : </span></td>
    <td width="295"><div id="Loading1" style="float:left;">
 <img src="images/Loading.jpg" style="vertical-align:middle;padding:6px"/>
 </div></td>
   
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td width="3">&nbsp;</td>
  </tr>
  <tr>
     <td width="411" align="center" style="font-size:20px">Msg_2 from Applet  </span></td>
    <td><div id="Loading2" style="float:left;"><img src="images/Loading.jpg" style="vertical-align:middle;padding:6px"/></div></td>
    <td>&nbsp;</td>
  </tr>
</table>


52
網頁技術 / Re: googlemap marker的訊息?
« 於: 2011-08-23 09:53 »
因為貼圖可能會不太清楚,所以用說明的

滑鼠移入時會跳到另一個從DB中取出的點

53
剛改了一下JAVA, 神奇的居然在firefox可以了~~~

54
Yamaka大大,
感謝分享的例子,
照你的範例,修改成我要的,但是在Firefox卻沒辦法秀出從applet接的訊息,但是在IE,chrome上是可以接到applet的訊息並秀在頁面上,
這應該是firefox的設定問題吧? 請問大大有遇過嗎??

55
給你一個~~"讚"啦~~

56
請問各位大大,
PHP要怎麼去接applet 的訊息 ??

57
網頁技術 / Re: googlemap marker的訊息?
« 於: 2011-08-18 18:39 »
我的情況好像跟大大不太一樣哩....

58
網頁技術 / googlemap marker的訊息?
« 於: 2011-08-18 17:24 »
滑鼠移入各點時出現描述,可是卻會移到別點座標上,也就是當我移到A點上時,會顯示訊息,可是座標值移到B點,這是那裡錯了嗎??????


代碼: [選擇]

<?
while($row = $db->fetch_array())
      {
          $latitude = $row['Latitude'];
         $longitude= $row['longitude'];
              $desc = $row['Description'];
?>
            <script language="javascript">
           var marker = new GMarker(new GLatLng(<? echo $latitude ?>,<? echo $longitude ?>));  // 從DB取出各點標示在地圖上

                     //滑鼠移入各點時出現描述,可是卻會移到別點座標上,這是那裡錯了嗎??????
 
  GEvent.addListener(marker,'mouseover',function(){
marker.openInfoWindowHtml(" <? echo $desc ?>");
});
   
GEvent.addListener(marker, 'mouseout', function () {
marker.closeInfoWindowHtml();
});
 
                         GEvent.addListener(marker, "click", function(marker, point) {
                             ................
                        });

  map.addOverlay(marker);
                                           
</script>
<?
}
?>


59
網頁技術 / Re: PHP下載檔案毁損?
« 於: 2011-08-17 16:54 »
是的~~原來只是取到路徑,難怪一直是空的...==''


請問在下載完成後,可以取得下載完成時間嗎?因為我想紀錄下載完成所需要的時間?

60
網頁技術 / Re: PHP下載檔案毁損?
« 於: 2011-08-17 16:14 »

代碼: [選擇]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>php download</title>
path 是 "路徑" ,是從這傳過去的,
Download.php

</head>
<?
$filepath = './TestFiles/';
$filename = 'test.zip';
?>
<body>
<a href="get_file.php?path=<?=$filepath?>&filename=<?=urlencode($filename)?>"><?=$filename?></a>
</body>
</html>



把   echo "success";去掉後,下載的檔案size變0KB,還是不能下載原始檔案?


頁: 1 [2] 3 4 ... 8