It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum

Text Box that changes current URL

Postby kame on Tue Aug 07, 2007 3:07 pm

My friends who are good at programming kept telling me to use javascript, but it seemed like this would work just the same
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby DDragon on Wed Aug 08, 2007 12:48 am

well the perl does worl ive used it myself for personal pages and such... its just a bugga to set up :) the javascript is easyer as far as placement goes :) as i said ill post the script to you when i find it again :)

Edit: I have found the script just now... if you want some help in inserting the script in ill be glad to help you there :)

Here is the script:
Code: Select all
<script language="javascript">

   function executeUrl()
      {
         var addy;

         addy = document.frmUrl.txtUrlentry.value;

         alert(addy + " is the current value");

         window.location.href = "http://www." + addy;
         window.location.reload();
      }

</script>


and here is an example of the form to make:
Code: Select all
<form name="frmUrl">
   Enter the URL of the page to go to:<br>http://<input name="txtUrlentry" type="text"><br><br>

   <input type="submit" name="btnUrlEntry" onclick="executeUrl()" value="Go!">
            
</form></center>


-- DD

-= "In a world the doesn't comprehend" =-
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby kame on Wed Aug 08, 2007 6:22 pm

Thanks again!

I am going to just copy and paste what I have in my box right now...

Code: Select all
<form name="frmUrl">
   Your Guess:<br><input name="txtUrlentry" type="text"><br><br>

   <input type="submit" name="btnUrlEntry" onclick="executeUrl()" value="Try It!">
           
</form></center>

<script language="javascript">

   function executeUrl()
      {
         var addy;

         addy = document.frmUrl.txtUrlentry.value;

         window.location.href = "http://radiumpuzzle.tripod.com/" + addy".html";
         window.location.reload();
      }

</script>


When I type in "test," this is the new url:

http://radiumpuzzle.tripod.com/1.html?t ... =Try+It%21
Am I not supposed to copy directly what your code was, or are there things that I need to change?
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby DDragon on Thu Aug 09, 2007 2:25 am

ok i found it... you need to change this line
Code: Select all
window.location.href = "http://radiumpuzzle.tripod.com/" + addy".html";
to look like this:
Code: Select all
window.location.href = "http://radiumpuzzle.tripod.com/" + addy + ".html";


that should fix it
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby kame on Sun Aug 12, 2007 9:24 pm

http://radiumpuzzle.tripod.com/1.html?t ... =Try+It%21

I am still getting that address. Do I need to put the javascript somewhere else?
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby DDragon on Tue Aug 14, 2007 2:27 pm

sorry thats my mistake, I should have told you to place the javascript in the head section of the HTML code...

It should look something like this:
Code: Select all
<html>
<head>
<title>Title of your page here</title>
<scriptlanguage="javascript">

   function executeUrl()
      {
         var addy;

         addy = document.frmUrl.txtUrlentry.value;

         window.location.href = "http://radiumpuzzle.tripod.com/" + addy".html";
         window.location.reload();
      }

</script>
</head>


place the javascript so its inbetween the head tags like that and it should fix your problem...
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby kame on Mon Aug 20, 2007 7:18 pm

.... That all makes sense, I do it all exactly, but it still isn't working!!!! I don't get it. I have that javascript in the very top of my page, under html, head, and title. I have txtUrlentry exactly the same in both. Could it be the spaces in "addy = document....? I'll just have to work around not having a text box. Thank you for helping.
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby DDragon on Tue Aug 21, 2007 11:37 am

ok post the entirety of your HTML code in here that you have written (without the tripod additions) and ill see if there is anything wrong from it...
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby kame on Wed Aug 22, 2007 12:08 am

Code: Select all
<html>
   <HEAD>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   
      <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <META http-equiv="Expires" content="0">
      <META name="TRELLIX_BUILDER_VER" content="1.0"><META name="TRELLIX_OPEN_SITE_COMMAND" content="http://build.tripod.lycos.com:80/trellix/sitebuilder/SiteBuilderServlet?fUrl=/trellix/sitebuilder/f_error.html&sUrl=/trellix/sitebuilder/f_edit_page.html&Command=OpenSite&FileName=306926595275820420/site.xml"></META>
      <!--base href="http://radiumpuzzle.tripod.com//"-->
      <!--/base--><script language="Javascript"><!--
      document.isTrellix = 1;
//                  --></script><title>1</title>
<scriptlanguage="javascript">

   function executeUrl()
      {
         var addy;

         addy = document.frmUrl.txtUrlentry.value;

         window.location.href = "http://radiumpuzzle.tripod.com/" + addy".html";
         window.location.reload();
      }

</script>

I'm not sure whether that is too much or too little. Later on in the script...
Code: Select all
                                 <p align="left"><font face="Verdana,Arial,Helvetica,sans-serif" size="2" color="ffffff"><form name="frmUrl">
                                       Your Guess:<br><input name="txtUrlentry" type="text"><br><br>
                                   
                                       <input type="submit" name="btnUrlEntry" onclick="executeUrl()" value="Try It!">
                                               
                                    </form></center>
                                   
                                   
                                    <!--"''"--></font>
                                 </p>
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby matt_raleigh on Fri Sep 21, 2007 1:49 pm

here's the code to do what you were asking, keeping it very simple (the >> means line wrap)

<form>
<input type="text" name="goto" Value = "http://www.">
<input type="button" VALUE="GO!">>
OnClick=location.href=goto.value;>
</form>
User avatar
matt_raleigh
 
Posts: 15
Joined: Thu Sep 20, 2007 6:45 pm

PreviousNext

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests