www.webdeveloper.com
Results 1 to 3 of 3

Thread: Dynamic URL

  1. #1
    Join Date
    Apr 2010
    Posts
    4

    Dynamic URL

    Hey Guys, I have the following code:

    Code:
    function gup( name )
    {
    	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
    	var regexS = "[\\?&]"+name+"=([^&#]*)";  
    	var regex = new RegExp( regexS );  
    	var results = regex.exec( window.location.href ); 
    	if( results == null )   
    	return "";  else    
    	return results[1];
    }
    Code:
       var total = gup( 't' );
       document.write("Current Standing: "+total); </script>
    </p>
    	<hr>
    	
    	<table class="sample">
    		<tr><td><input type="checkbox" name="box1" value="750.00" onclick="total=total+750.00;"></td><td>Up to 150,000</td><td>750</td></tr>
    <tr><td><input type="checkbox" name="box1" value="800.00" onclick="total=total+800.00;"></td><td>Up to 200,000</td><td>750</td></tr>
    	
    	</table>
    	
    </body>
    How do I make a dynamic link? like :

    Code:
    document.write('<A HREF=url.htm?t=' + total + '>Next</a>')
    ?

  2. #2
    Join Date
    Apr 2010
    Posts
    4
    im passing across url's like this: http://domain.com/url.htm?t=40.00

    PHP is not an option.

  3. #3
    Join Date
    Apr 2010
    Posts
    4
    Done:

    Code:
     function addup(s) {
    	  if (s.checked == false) {   // Item was uncheck. Subtract item value from total.
    			total= eval(total) - eval(s.value);
    			 } else {   // Item was checked. Add the item value to the total.
    			total= eval(total) + eval(s.value);
    			
    		}
    	document.getElementById("link").href="commercial-sale2.htm?t=" + total + ".00";
        }
        </script>
    	<a href="commercial-sale2.htm?t=0.00" id="link">Next</a>
    this seems to work great

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles