代码:
Sub Demo()
Application.ScreenUpdating = False
Dim StrFnd As String, Rng As Range, i As Long
StrFnd = InputBox("What is the Text to Find")
If Trim(StrFnd) = "" Then Exit Sub
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = StrFnd
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found
i = .Information(wdActiveEndAdjustedPageNumber)
Set Rng = ActiveDocument.GoTo(What:=wdGoToPage, Name:=i)
Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page")
If Rng.Tables.Count > 0 Then
MsgBox Chr(34) & StrFnd & Chr(34) & " and table found on page " & i & "."
With Rng.Tables(1)
'process this table
End With
Else
MsgBox Chr(34) & StrFnd & Chr(34) & " found on page " & i & " but no table."
End If
.Start = Rng.End
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
在这段代码中,我创建了一个ajax jquery脚本,我正在使用onclick函数。现在当我点击
时会发生什么<script>
$(document).ready(function(){
$(".apply").click(function(){
idd = this.id;
fname = $("#fname").val();
company_name = $(".company_name_"+idd).val();
phone = $("#phone").val();
alert(fname);
alert(company_name);
alert(phone);
$.ajax({
type:"POST",
data:{"fname":fname, "company_name":company_name, "phone":phone},
url:"get_data.php",
success:function(data){
$("#search").html(data);
}
});
});
});
</script>
<?php
$sql = "select * from company";
$results = mysqli_query($con,$sql);
while($rows = mysqli_fetch_array($results))
{
echo "<input type='text' name='company_name' class='company_name_".$rows['id']."' value='".$rows['company_name']."'/>";
echo "<a href='javascript:void(0)' id='".$rows['id']."' class='apply'>click me</a>";
}
?>
<?php
$query = "select * from login where id = '".$ids."'";
$result = mysqli_query($con,$query);
while($row = mysqli_fetch_array($result))
{
?>
<input type="hidden" name="fname" id="fname" value="<?php echo $row['fname']; ?>"/>
<input type="hidden" name="phone" id="phone" value="<?php echo $row['phone']; ?>"/>
<?php
}
?>
Ajax回调两次,即它提醒值两次,但我想要一次。我不知道为什么?那么,我该如何解决这个问题?
谢谢