SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Change line of code to button

    How can I change the line "Re-record this video" to a button.
    And How can I change it's location on the page? Thanks.

    Code:
    document.write("<p><a href='index.html?filename="+my_filename+"'>Re-record this video</a><br/><br/>");

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <input type="button" value="Re-record" onclick="window.location='index.html?filename='+my_filename+'" />
    Are you using document.write() to create your page?

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that help.
    I didn't write this script, so I'm not sure if it's to "create the page".
    I'm not very versed in javascript.
    I don't know where I can use your posted code in this script below. Any additional help will be greatly appreciated.

    Code:
    <script type="text/javascript">
    		var my_filename	= get_parm('filename');
    		var file		= document.getElementById("form_filename");
    		file.value 		= my_filename;
    		var flashvars = {
    		file: my_filename,
    		streamer: "rtmp://67.xxx.xxx.xxx"
    		}
    		document.write("<p><a href='index.html?filename="+my_filename+"'>Re-record this video</a><br><br>");
    		swfobject.embedSWF("player.swf", "player", "640", "480", "9", "expressInstall.swf", flashvars);
    
    
    		function get_parm(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];
    				}
    			}
    	</script>

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use it where your current <a> tag is:

    Code:
    		document.write("<input type=\"button\" value=\"Re-record\" onclick=\"window.location='index.html?filename='+my_filename+'\" /><br><br>");
    For changing its position, you can use CSS but document.write() outputs the code straight away so where ever you put the above Javascript it likely where the button will be shown.

  5. #5
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help.
    I tried your line of code, as-is. It showed a button, but I wasn't redirected when I selected the button.
    I guess it's because I don't know what you mean when you state "Use it where your current <a> tag is".
    Any additional help will be appreciated.


Bookmarks

Posting Permissions

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