关闭

small javascript code to check urls..

这项目被授予 professional1248 ,费用为£11 GBP

为像这样的项目获取免费报价
雇主工作
项目预算
£10 - £20 GBP
全部竞标
2
项目描述

(To be done either in javascript or using jQuery)

- A form has a textfield: search_or_url e.g.

<form method="post" action="#" id="myForm">

<input type="text" name="search_or_url" /><br />

<button name="Search or Add" type="submit"></button>

</form>

- On Submission of form. Strip whitespace at ends of search_or_url Check:

Is search_or_url a URL?

If it is, Does the URL fit one of these:

[url removed, login to view][string]

[url removed, login to view]:[int]

[url removed, login to view][string]

[url removed, login to view][string]

[url removed, login to view][user]/[string]

(NB: should cope with [url removed, login to view] or [url removed, login to view])

If it does alert('/save/domain/[url]/[parts]')

e.g. /save/sourceforge/projects/sawat

/save/thingiverse/thing:191991

/save/pinshape/items/adadadaad-asdam9a99da

/save/instructables/id/sasdaadada

/save/github/user-id/strasdaiiasdia

If it doesn't match these alert('cant add site yet')

If it isnt a url, alert('searching for '[entered text]').

在寻找赚取金钱的机会?

  • 设定您的预算和时间框架
  • 大致描述您的建议方案
  • 为您的工作领取工资

雇用同样在该项目上竞标的威客

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online