Jump to content

HTML Button


arunk.fun
 Share

Recommended Posts

Hello All,
I put my question straight here.
If my website address is www.abcd.in a ""Click Here"" button should be linked to http://www.XXXXXXXX.com/?r=1234567 [FIXED]
If my website address is www.abcd.in/?r=1111111 a ""Click Here"" button should be linked to
http://www.XXXXXXXX.com/?r=1111111 ["1111111" Its a 7digit number may vary per user]
Please help me a HTML Code with javascript in it for creating a Click here button.
Refer: www.click2rupee.com
www.click2rupee.com = CLICK HERE Button= http://www.clixsense.com/?r=3488429
www.click2rupee.com/?r=12312312 = CLICK HERE Button= http://www.clixsense.com/?r=12312312
Thanks All.
Link to comment
Share on other sites

function parseHTTPGet(win){   var data = {};   if(!win)      win = window;   if(win.location.search.length <1) return data;   var getDataArray = win.location.search.substr(1).split("&");   for (var i =0; i<getDataArray.length;i++){      var keyVal = getDataArray.split("=");      data[unescape(keyVal[0])] = (keyVal[1].length)?unescape(keyVal):undefined;   }   return data;}var reference = parseHTTPGet();//"1111111" is default reference if no get data was passedvar getstring = encodeURIComponent(!reference.r || reference.r == undefined ? "1111111":reference.r);document.getElementById("clickRefer").href = "http://www.clixsense.com/?r="+getstring;
HTML link
<a id="clickRefer" href="http://www.clixsense.com/?r=1111111" >Click Here</a>
  • Like 1
Link to comment
Share on other sites

function parseHTTPGet(win){   var data = {};   if(!win)      win = window;   if(win.location.search.length <1) return data;   var getDataArray = win.location.search.substr(1).split("&");   for (var i =0; i<getDataArray.length;i++){      var keyVal = getDataArray.split("=");      data[unescape(keyVal[0])] = (keyVal[1].length)?unescape(keyVal):undefined;   }   return data;}var reference = parseHTTPGet();//"1111111" is default reference if no get data was passedvar getstring = encodeURIComponent(!reference.r || reference.r == undefined ? "1111111":reference.r);document.getElementById("clickRefer").href = "http://www.clixsense.com/?r="+getstring;
HTML link
<a id="clickRefer" href="http://www.clixsense.com/?r=1111111" >Click Here</a>
I put exact values here
IF www.rupeerain.in then "CLICK HERE" Button to be linked to http://www.neobux.com/?r=rupeerain
IF www.rupeerain.in/?r=xxxxxxxxxxx then "CLICK HERE" Button to be linked to http://www.neobux.com/?r=xxxxxxxxxxx
NOTE xxxxxxxxxxx may be alphanumeric and has no counts
Please help me to write the scripts between the below
<HTML>

<head><TITLE>Simple Script 1 Phase 1</TITLE></head><Body><SCRIPT LANGUAGE = JavaScript>

</SCRIPT></Body></HTML>

Link to comment
Share on other sites

Godaddy should both be able to and allow you to write js code on their site. a publicly accessible HTML page without javascript on it is exceedingly rare these days. you should be able to give a page like this to Godaddy.

<!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>Simple Script 1 Phase 1</title>        <script type="text/javascript">            var defaultUrl = "rupeerain";            function parseHTTPGet(win){                var data = {};                if(!win) win = window;                if(win.location.search.length<1) return data;                var getDataArray = win.location.search.substr(1).split("&");                for(var i=0li<getDataArray.length;i++){                    var keyVal = getDataArray[i].split("=");                    data[unescape(keyVal[0])] = (keyVal[1].length)?unescape(keyVal[1]):undefined;                }                return data;            }            function objToUri(obj){                var arr = [];                for(prop in obj){                    if(typeof obj.prop != "undefined")                         arr.push(encodeURIComponent(prop)+"="+encodeURIComponent(obj.prop));                }                return arr.join("&");            }            function doOnLoad(){                var relink = parseHTTPGet();                //if r wasn't passed, sets to defaultUrl                 relink.r = relink.r || defaultUrl;                document.getElementById("clickRefer").href +="?"+objToUri(relink);               }        </script>    </head>    <body onload="doOnLoad()">        <a id="clickRefer" href="www.neobux.com/">CLICK HERE</a>    </body></html>
Link to comment
Share on other sites

 

Godaddy should both be able to and allow you to write js code on their site. a publicly accessible HTML page without javascript on it is exceedingly rare these days. you should be able to give a page like this to Godaddy.

<!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>Simple Script 1 Phase 1</title>        <script type="text/javascript">            var defaultUrl = "rupeerain";            function parseHTTPGet(win){                var data = {};                if(!win) win = window;                if(win.location.search.length<1) return data;                var getDataArray = win.location.search.substr(1).split("&");                for(var i=0li<getDataArray.length;i++){                    var keyVal = getDataArray[i].split("=");                    data[unescape(keyVal[0])] = (keyVal[1].length)?unescape(keyVal[1]):undefined;                }                return data;            }            function objToUri(obj){                var arr = [];                for(prop in obj){                    if(typeof obj.prop != "undefined")                         arr.push(encodeURIComponent(prop)+"="+encodeURIComponent(obj.prop));                }                return arr.join("&");            }            function doOnLoad(){                var relink = parseHTTPGet();                //if r wasn't passed, sets to defaultUrl                 relink.r = relink.r || defaultUrl;                document.getElementById("clickRefer").href +="?"+objToUri(relink);               }        </script>    </head>    <body onload="doOnLoad()">        <a id="clickRefer" href="www.neobux.com/">CLICK HERE</a>    </body></html>

Thanks Bro I tried but its not working.

 

1) When my URL was rupeerain.in my click here button should go to www.neobux.com/?r=rupeerain but instead it goes to "http://rupeerain.in/www.neobux.com/?r=rupeerain"

 

2) When my URL was rupeerain.in/?r=duthararaj my click here button should go to www.neobux.com/?r=duthararaj

 

Please help :)

The above method works on www.fastrupee.com

Link to comment
Share on other sites

There was a syntax error in parseHTTPGet() when i rewrote it, and a semantic error in objToUri(). I also made it a little more robust in adding the search value to clickRefer.href. also the anchor tag was adding that other url because the original href didn't provide a proper protocol.

make sure href start with a "http://" and ends with a "/" when writing them out, or javascript will automatically prepend the current address.(apparently when you type "http://" in a paragraph it makes the entire paragraph disappear from the post, so I'm using a code block to escape it)
this code has been tested and works
<!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>Simple Script 1 Phase 1</title>        <script type="text/javascript">            var defaultUrl = "rupeerain";            function parseHTTPGet(win){                var data = {};                if(!win) win = window;                if(win.location.search.length<1) return data;                var getDataArray = win.location.search.substr(1).split("&");                for(var i=0;i<getDataArray.length;i++){                    var keyVal = getDataArray[i].split("=");                    data[unescape(keyVal[0])] = (keyVal[1].length)?unescape(keyVal[1]):undefined;                }                return data;            }            function objToUri(obj){                var arr = [];                for(prop in obj){                    if(typeof obj[prop] != "undefined")                         arr.push(encodeURIComponent(prop)+"="+encodeURIComponent(obj[prop]));                }                return arr.join("&");            }            function doOnLoad(){                var clickRefer= document.getElementById("clickRefer");                var relink = parseHTTPGet();                //if r wasn't passed, sets to defaultUrl                 relink.r = relink.r || defaultUrl;                clickRefer.href += (relink.length)? "?"+objToUri(relink) : "";               }        </script>    </head>    <body onload="doOnLoad()">        <a id="clickRefer" href="http://www.neobux.com/">CLICK HERE</a>    </body></html>
Link to comment
Share on other sites

There was a syntax error in parseHTTPGet() when i rewrote it, and a semantic error in objToUri(). I also made it a little more robust in adding the search value to clickRefer.href. also the anchor tag was adding that other url because the original href didn't provide a proper protocol.

make sure href start with a "http://" and ends with a "/" when writing them out, or javascript will automatically prepend the current address.(apparently when you type "http://" in a paragraph it makes the entire paragraph disappear from the post, so I'm using a code block to escape it)
this code has been tested and works
<!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>Simple Script 1 Phase 1</title>        <script type="text/javascript">            var defaultUrl = "rupeerain";            function parseHTTPGet(win){                var data = {};                if(!win) win = window;                if(win.location.search.length<1) return data;                var getDataArray = win.location.search.substr(1).split("&");                for(var i=0;i<getDataArray.length;i++){                    var keyVal = getDataArray[i].split("=");                    data[unescape(keyVal[0])] = (keyVal[1].length)?unescape(keyVal[1]):undefined;                }                return data;            }            function objToUri(obj){                var arr = [];                for(prop in obj){                    if(typeof obj[prop] != "undefined")                         arr.push(encodeURIComponent(prop)+"="+encodeURIComponent(obj[prop]));                }                return arr.join("&");            }            function doOnLoad(){                var clickRefer= document.getElementById("clickRefer");                var relink = parseHTTPGet();                //if r wasn't passed, sets to defaultUrl                 relink.r = relink.r || defaultUrl;                clickRefer.href += (relink.length)? "?"+objToUri(relink) : "";               }        </script>    </head>    <body onload="doOnLoad()">        <a id="clickRefer" href="http://www.neobux.com/">CLICK HERE</a>    </body></html>

Hello Bro.

 

My URL http://www.rupeerain.in connects to Neobux href="http://www.neobux.com/?r=rupeerain.

I changed the script <a id="clickRefer" href="http://www.neobux.com/?r=rupeerain">CLICK HERE</a>

 

When my URL is http://www.rupeerain.in/?r=duthuraj it should link to http://www.neobux.com/?r=duthuraj but its not.

 

Please help Bro.

 

Thanks for all your efforts.

Link to comment
Share on other sites

  • 3 weeks later...

Instead of using JS, I prefer to use PHP If statements, I find it more effective and more functionality. Personally this is my opinion. But I recommend trying it as you can use them for most things.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...