Home Backend Development PHP Tutorial 怎么实现链接转换

怎么实现链接转换

Jun 13, 2016 am 10:42 AM
getelementbyid lt quot var

如何实现链接转换?
举个例子:
链接格式:

 /php/“**”/“##" 

我想实现的功能是,网页上三个输入框
第1个输入框,用户输入,**的内容
第2个输入框,用户输入,##的内容
第3个输入框,显示生成的新地址:/php/“**”/“##" ,再加一个点击复制按钮
谁能提供下源码,万谢!!
我是学vc,vc定义变量就行,可是网页编程一窍不通啊。。

------解决方案--------------------


输入框1:

输入框2:

输入框3:
复制






<script><br />function gett3()<br />{<br /> var t1 = document.getElementById('t1').value;<br /> var t2 = document.getElementById('t2').value;<br /> var t3 = '/php/'+t1+'/'+t2;<br /> document.getElementById("t3").value=t3;<br />}<br /><br />function DoCopy(obj)<br />{ <br /> //alert(obj);return false;<br /> if(copy2Clipboard(obj)!=false)<br /> {<br /> //alert("复制成功!");<br /> }<br />}<br />copy2Clipboard=function(txt)<br />{<br /> if(window.clipboardData)<br /> {<br /> window.clipboardData.clearData();<br /> window.clipboardData.setData("Text",txt);<br /> }<br /> else if(navigator.userAgent.indexOf("Opera")!=-1)<br /> {<br /> window.location=txt;<br /> }<br /> else if(window.netscape)<br /> {<br /> try<br /> {<br /> netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");<br /> }<br /> catch(e)<br /> {<br /> alert("您的firefox安全限制限制您进行剪贴板操作,请打开’about:config’将signed.applets.codebase_principal_support’设置为true’之后重试,相对路径为firefox根目录/greprefs/all.js");<br /> return false;<br /> }<br /> var clip=Components.classes[[email&#160;protected]/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);<br /> if(!clip)return;<br /> var trans=Components.classes[[email&#160;protected]/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);<br /> if(!trans)return;<br /> trans.addDataFlavor('text/unicode');<br /> var str=new Object();<br /> var len=new Object();<br /> var str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);<br /> var CopyCode=txt;str.data=CopyCode;<br /> trans.setTransferData("text/unicode",str,CopyCode.length*2);<br /> var clipid=Components.interfaces.nsIClipboard;<br /> if(!clip)return false;<br /> clip.setData(trans,null,clipid.kGlobalClipboard);<br /> }<br />}<br /></script>

复制的程序是从网上copy下来的。。。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
18 Ways to Fix Audio Service Not Responding Issue on Windows 11 18 Ways to Fix Audio Service Not Responding Issue on Windows 11 Jun 05, 2023 pm 10:23 PM

Audio output and input require specific drivers and services to work as expected on Windows 11. These sometimes end up running into errors in the background, causing audio issues like no audio output, missing audio devices, distorted audio, etc. How to Fix Audio Service Not Responding on Windows 11 We recommend you to start with the fixes mentioned below and work your way through the list until you manage to resolve your issue. The audio service may become unresponsive for a number of reasons on Windows 11. This list will help you verify and fix most issues that prevent audio services from responding on Windows 11. Please follow the relevant sections below to help you through the process. Method 1: Restart the audio service. You may encounter

Let's talk about the differences between var, let and const (code example) Let's talk about the differences between var, let and const (code example) Jan 06, 2023 pm 04:25 PM

This article brings you relevant knowledge about JavaScript. It mainly introduces the differences between var, let and const, as well as the relationship between ECMAScript and JavaScript. Interested friends can take a look at it. I hope Helpful to everyone.

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

The role and examples of var keyword in PHP The role and examples of var keyword in PHP Jun 28, 2023 pm 08:58 PM

The role and examples of var keyword in PHP In PHP, the var keyword is used to declare a variable. In previous PHP versions, using the var keyword was the idiomatic way to declare member variables, but its use is no longer recommended. However, in some cases, the var keyword is still used. The var keyword is mainly used to declare a local variable, and the variable will automatically be marked as local scope. This means that the variable is only visible within the current block of code and cannot be accessed in other functions or blocks of code. Use var

请教怎么修改url某一参数的参数值呢?是要拆开了再拼回去吗 请教怎么修改url某一参数的参数值呢?是要拆开了再拼回去吗 Jun 13, 2016 am 10:24 AM

请问如何修改url某一参数的参数值呢?是要拆开了再拼回去吗?那么请问如何修改url某一参数的参数值呢?是要拆开了再拼回去吗?http://127.0.0.1/myo/newuser.php?mod=search&type=fastone比如现在我要修改mod=new要怎么做呢?------解决方案--------------------发送了请求

Solution to the error AttributeError(\'{0!r} object has no attribute {1!r}\'.format(type(self).__name__, k)) Solution to the error AttributeError(\'{0!r} object has no attribute {1!r}\'.format(type(self).__name__, k)) Feb 29, 2024 pm 06:40 PM

The reason for the error message indicates that in the python code, an object (represented by the self variable) is used, but the object does not have an attribute named k. This may be because the object does not have this property defined, or a type error in the code causes the object to not be of the expected type. How to Fix To resolve this error, you may need to do one or more of the following: Check your code for the error and make sure the object referenced by the self variable has a property named k. Check your code for type errors and make sure the object referenced by the self variable is of the expected type. If the attribute is missing, you need to define this attribute in the class and use tryexcept to get this error. If you are sure that k is an attribute that is not defined in the class, please confirm

How to use getElementById How to use getElementById Sep 01, 2023 am 11:03 AM

getElementById can obtain the corresponding HTML element through the id attribute of the element, and then operate and modify it conveniently. Whether it is to dynamically change the content and style of an element or add an event listener, getElementById is a very commonly used method.

Microsoft is rolling out Windows 11 23H2 build to the release preview channel with Copilot Microsoft is rolling out Windows 11 23H2 build to the release preview channel with Copilot Sep 28, 2023 pm 07:17 PM

Everyone is looking forward to today's Windows 1123H2 release. In fact, Microsoft has just launched updates to the release preview, which is the closest channel before the official release stage. Known as Build 22631, Microsoft said they are rolling out the new rebranded chat app, phone link, and play together widgets that have been tested on other internal channels over the past few months. "This new update will have the same servicing branch and codebase as Windows 11 version 22H2 and will be cumulative with all newly announced features, including Copilot in Windows (preview)," Microsoft promises. Redmond officials further

See all articles