2016-04-21 87 views
0

我用语音XML来选择标志或电影。把logo.svgmovie.phptxt文件,然后我用PHP来加载logo.svgmovie.php$theData如何使用TXT内容的onclick =“doAjaxCall(”“)?

<?php 
ini_set("display_errors", true); 

// define your file name as a variable 
$myFile = "voice.txt"; 

// get a FILE HANDLE to the file: 'r' means set permission to read 
$fh = fopen($myFile, 'r'); 

//read the entire file and store the contents in the variable $theData 
$theData = fread($fh, filesize($myFile)); 

// close the file so it will be OK to use later 
fclose($fh); 

//echo whatever is in the file back to the browser 
echo $theData; 



// PART 2 
// get a FILE HANDLE to the file: 'a' means set permission to read 
$fh = fopen($myFile, 'w') or die("Error trying to open with a"); 

$noData = "no msgs"; 

//read the entire file and store the contents in the variable $theData 
$theData = fwrite($fh, $noData); 

// close the file so it will be OK to use later 
fclose($fh) 

?> 

现在我想告诉他们要么对网 我使用:??

<input class="logo" type="button" value="Call (832) 271-6319 " onclick="doAjaxCall(' ');"/> 

我怎样才能做到这一点我应该使用JavaScript

+0

我用这个在HTML <输入类= “标志” 类型= “按钮” 值= “调用(832)271-6319” 的onclick = “doAjaxCall( 'movie.php');”/> – vivian

+0

我不明白你想达到什么。 onclick允许你添加一个javascript函数。你可以用这个函数进行ajax调用。 –

回答

0

我不知道你想达到什么。 的onclick允许你添加一个JavaScript函数一样

<input onclick="myFunction()" /> 

你可以从这个函数调用Ajax。 或者你可以使用jQuery并附加一个函数来输入点击事件。

$(".logo").click(function(){ 
..... 
}); 
+0

谢谢你的回复。我打电话说徽标,网页上会显示logo.svg。我该怎么办。 – vivian