这是一个简单的问题,我有一个变量(一个字符串),根据用户操作在上一页的内容而变化,它可以是' package',' content&#39 ;等
由于修改可能会产生影响,我想通过使用确认方法确保用户知道他的行为,确认方法,"您确定要删除此包"如果这是一个包或者"你是......这个内容"等
在我的JS中我做到了:
#url = raw_input('Enter - ')
url = 'http://www.columbia.edu/kermit/k95.html'
itr = raw_input('Enter iteration: ')
i = int(itr)
n = raw_input('Enter Number: ')
n = int(n)
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html)
tags = soup('a')
print 'Link:' , url
while i > 0:
i = i - 1
if i == 0:
break
for tag in tags:
me = tag.get('href', None)
#Just to make sure the link/content match print tag.contents[0]
link = tags[(n - 1)]
#print link
links = link.get('href', None)
print 'Link:', links
Enter - http://www.columbia.edu/~fdc/
Enter count: 4
Enter Position: 9
Link: http://www.columbia.edu/~fdc/
Link: http://www.columbia.edu/kermit/k95.html
Link: http://www.columbia.edu/kermit/k95.html (Should be k95faq.html)
Link: http://www.columbia.edu/kermit/k95.html (Should be ckfaq.html)
我想这样做:
var sCategorieType = $(this).closest('tr').attr('name');
这不起作用,我想知道为什么并有另一种选择。
答案 0 :(得分:1)
javascript中的连接与PHP中的连接不同。在javascript中,您可以将字符串与+
符号连接起来。
尝试:
var bConfirm = confirm("Are you sure you want to delete this " + sCategorieType + "? ");
答案 1 :(得分:1)
将其与“+”连接,而不是与“。”连接。符号,它会好的! :)
var bConfirm = confirm("Are you sure you want to delete this " + sCategorieType + "? ");
祝你好运!)